Found 37 issues

First time here? 👋

Welcome to Find a PR.

Find a PR is an open-source site that is built to help developers find projects so that they can submit their very first pull request.

If you're a contributor looking to find a project to contribute to, feel free to browse through the list below.

If you're a maintainer looking to list your project on Find a PR, you can read how to do this in the documentation.

bug help wanted

I'm playing around with this package and noticed, that when following the documentation for aggregate partials and creating a snapshot of the aggregate root, the state of the partial is not stored in the snapshot. Not sure if that is intended or a bug, as I didn't find a test for this usecase and the documentation didn't mentions snapshots and aggregate partials.

View more
3 comments
saschanowak

saschanowak

8th Jan 2022 @ 17:05

findapr

Im using PHPFlasher in a symfony application however it adds session state when not in use. I am combining it with API Platform and my API itself it stateless so it should not hold any session data (causes errors).

How should i handle this (if even possible?)

View more
13 comments
pimjansen

pimjansen

2nd Jun 2023 @ 12:24

Feature help wanted

Calling for help from Docker experts. We need to create the best possible docker-compose.yml file for this project. The application requirements are well defined (we use env vars, Webpack Encore, PHP 7.1, Symfony 4.1, SQLite database, etc.) so it should be possible to create that file.

View more
22 comments 👍 28
javiereguiluz

javiereguiluz

21st May 2018 @ 09:37

enhancement help wanted hacktoberfest

Describe the bug I have a table which has an order column. When I reorder the elements I update each model with the new order. Because the table has some large JSON columns I select only id and order columns for efficiency. I set the new order and save the model.

foreach (Faq::query()->get(['id', 'order']) as $faq) {
    $faq->order = $newOrder[$faq->id];
    $faq->save();
}

The diffs created in the activity_log table look like this:

{
   "old": {
      "order": 1,
      "answer": null,
      "question": null
   },
   "attributes": {
      "order": 2,
      "answer": "long JSON content",
      "question": "long JSON content"
   }
}

From what I see laravel-activitylog fetches the model with all columns from the database before creating a log entry which kind of defeats the purpose of my "select list optimization" and produces an incorrect diff.

Generally I want these large JSON columns to be logged in case a user changes them but in this case I only change the order column so I would like to see only the order column in the diff.

I have tried running these updates straight off the Eloquent builder:

Faq::query()->where('id', $id)->update(['order' => $newOrder[$id]]);

but in this case nothing is logged.

I have the following activitylog configuration for my models:

public function getActivitylogOptions(): LogOptions
{
    return LogOptions::defaults()
                     ->logAll()
                     ->logOnlyDirty()
                     ->logExcept([
                         'id',
                         'created_at',
                         'updated_at',
                     ]);
}

To Reproduce Select a subset of columns from the database, change these columns, save the model and see that other (not initially selected) columns are present in the diff.

Expected behavior Only columns that've actually been changed should be present in the diff.

Versions

  • PHP: 8.1
  • Database: MySQL 8
  • Laravel: 9.31.0
  • Package: 4.6.0
View more
3 comments
KKSzymanowski

KKSzymanowski

28th Sep 2022 @ 21:53

enhancement help wanted
  • standard tags
  • input fields
  • components
  • patterns

Add code snippets for each block

View more
👍 1
willemvb

willemvb

25th Jul 2016 @ 12:49

help wanted

Laravel Version

10.23

PHP Version

8.2.10

Database Driver & Version

No response

Description

When validating arrays using the rules Rule::in() or Rule::exists() it returns the array in a different order than the original. This happens only if the key that is being validated is optional and uses one of the rules described above.

(there might be more rules this applies to)

A simple ksort() on my end would fix this but in my opinion it would be a better DX if the order doesn't change.

In our case we use the order of the array to store our own sort_order in the database but we are forced to keep adding ksort() everywhere.

Let me know if anyone needs more info.

Steps To Reproduce

Tinker(well)-friendly reproduction

$data = [
    'books' => [
        ['title' => 'Harry Potter', 'author' => 'J.K. Rowling'],
        ['title' => 'Lord of the Rings', 'author' => 'J.R.R. Tolkien'],
        ['id' => '3', 'title' => 'The Hobbit', 'author' => 'J.R.R. Tolkien'],
        ['title' => 'A Game of Thrones', 'author' => 'George R.R. Martin'],
    ]
];

$validated = Illuminate\Support\Facades\Validator::validate($data, [
    'books' => 'array',
    'books.*.id' => [
        Illuminate\Validation\Rule::in(['1', '2', '3', '4']),
    ],
    'books.*.title' => 'required|string',
]);

dd($validated);

This produces the following output (mind the array keys):

array:1 [▼ 
  "books" => array:4 [▼
    2 => array:2 [▼
      "id" => "3"
      "title" => "The Hobbit"
    ]
    0 => array:1 [▼
      "title" => "Harry Potter"
    ]
    1 => array:1 [▼
      "title" => "Lord of the Rings"
    ]
    3 => array:1 [▼
      "title" => "A Game of Thrones"
    ]
  ]
]

To prove it works when the optional key is present on all entries

$data = [
    'books' => [
        ['id' => '1', 'title' => 'Harry Potter', 'author' => 'J.K. Rowling'],
        ['id' => '2', 'title' => 'Lord of the Rings', 'author' => 'J.R.R. Tolkien'],
        ['id' => '3', 'title' => 'The Hobbit', 'author' => 'J.R.R. Tolkien'],
        ['id' => '4', 'title' => 'A Game of Thrones', 'author' => 'George R.R. Martin'],
    ]
];

$validated = Illuminate\Support\Facades\Validator::validate($data, [
    'books' => 'array',
    'books.*.id' => [
        Illuminate\Validation\Rule::in(['1', '2', '3', '4']),
    ],
    'books.*.title' => 'required|string',
]);

dd($validated);

Produces:

array:1 [▼
  "books" => array:4 [▼
    0 => array:2 [▼
      "id" => "1"
      "title" => "Harry Potter"
    ]
    1 => array:2 [▼
      "id" => "2"
      "title" => "Lord of the Rings"
    ]
    2 => array:2 [▼
      "id" => "3"
      "title" => "The Hobbit"
    ]
    3 => array:2 [▼
      "id" => "4"
      "title" => "A Game of Thrones"
    ]
  ]
]
View more
2 comments
larskoole

larskoole

18th Sep 2023 @ 13:17

help wanted question

AST, or "abstract syntax tree", creates the expectation of a nested tree structure. In the case of a query string, the AST will only ever be one level deep; as multi nodes are combined into one.

If anyone wants to suggest a better, more clear name: you're welcome.

View more
1 comment
brendt

brendt

20th Dec 2018 @ 13:41

help wanted

I would be good to support normalizer_get_raw_decomposition function that appeared in PHP 7.3. I've tried to implement it but seems that existing decomposition data is already optimized to get the final decomposition. Example test case is available here. Pinging @nicolas-grekas as he is the author of Normalizer polyfill.

View more
4 comments
IonBazan

IonBazan

12th May 2018 @ 23:26

enhancement help wanted

Add a new settings section for notifications with a setting to globally turn off/on notifications for subscriptions to threads, including mentions.

View more
14 comments
driesvints

driesvints

16th Feb 2022 @ 15:26

help wanted

NotOrm Package

The goal is to make abstract code based on the package notorm to build a new orm system

View more
ambroisehdn

ambroisehdn

15th Jun 2022 @ 12:34

help wanted

Laravel Version

10.13.1

PHP Version

8.2.8

Database Driver & Version

PostgreSQL 14.2, compiled by Visual C++ build 1914, 64-bit

Description

Problem

In Postgres we have two DISTINCT statements. Simple DISTINCT and DISTINCT ON (column). It works differently. If first DISTINCT statement will remove repeated rows, the DISTINCT ON works like grouping and it requires grouping statements, ordering for distinct column and etc.

If we will going to laravel framework code we will see method runPaginationCountQuery used by query pagination. It need for calculating total rows in our query. But there are no distinct conditions or something. And if we add ->paginate($perPage) to our query (see Steps To Reproduce) we will get 2 rows instead of 1. Because runPaginationCountQuery will remove our distinct for total row calculating.

// src/Illuminate/Database/Query/Builder.php
...
// 2876 row
   /**
     * Run a pagination count query.
     *
     * @param  array  $columns
     * @return array
     */
    protected function runPaginationCountQuery($columns = ['*'])
    {
        if ($this->groups || $this->havings) {
            $clone = $this->cloneForPaginationCount();

            if (is_null($clone->columns) && ! empty($this->joins)) {
                $clone->select($this->from.'.*');
            }

            return $this->newQuery()
                ->from(new Expression('('.$clone->toSql().') as '.$this->grammar->wrap('aggregate_table')))
                ->mergeBindings($clone)
                ->setAggregate('count', $this->withoutSelectAliases($columns))
                ->get()->all();
        }

        $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset'];

        return $this->cloneWithout($without)
                    ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order'])
                    ->setAggregate('count', $this->withoutSelectAliases($columns))
                    ->get()->all();
    }
    
...

Adding $columns parameter for ->paginate($perPage, $columns) method also did not worked because runPaginationCountQuery remove all columns statements and of course DISTINCT too.

But some recomedations tell us to add $columns parameter to ->distinct($columns) like this:


use App\Models\Organization;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class User extends Model
{
...

    public function getOrganizationsWithPermission($permission_id): BelongsToMany
    {
        return $this->belongsToMany(Organization::class, 'user_roles', 'user_id', 'organization_id')
            ->join('roles', 'roles.id', '=', 'user_roles.role_id')
            ->join('role_permissions', 'role_permissions.role_id', '=', 'roles.id')
            ->join('permissions', 'permissions.id', '=', 'role_permissions.permission_id')
            ->where('permissions.id', '=', $permission_id)
            // like this
            ->distinct('organization.id');
            // or like this
            // ->distinct(['organization.id']);
    }

...

In this case with Postgres we will get DISTINCT ON in Laravel and we can not using this query for example dynamic sorting because we will need to add firstly ORDER BY organizations.id statement for our DISTINCT ON. After that we will need to add grouping for columns and etc. Our construction will be badly working for continue querying.

But as we see in code runPaginationCountQuery we have condition with checking groups and havings. If we have query with grouping statement runPaginationCountQuery using our query as subquery without column changes. And it works!

Conclusion

If we have total counting for our queries with groupping like wrapping as subquery, why we can not using it for simple DISTINCT? Thank you.

Steps To Reproduce

  1. Add 4 models in Laravel: User, Organzation, Role, Permission
  2. User: id, name
  3. Organization: id, name
  4. Role: id, name
  5. Permission: id, name
  6. Add table for linking roles with permissions role_permissions: role_id, permission_id with unique index (role_id, permission_id).
  7. Add table for linking users with roles and organizations user_roles: role_id, organization_id and user_id with unique index (role_id, organization_id, user_id).
  8. Fill our tables:
INSERT INTO users (id, name) VALUES (1, 'user');
INSERT INTO organizations (id, name) VALUES (1, 'org');
INSERT INTO roles (id, name) VALUES (1, 'role1'), (2. 'role2');
INSERT INTO permissions (id, name) VALUES (1, 'permission');

-- add same permission to both roles
INSERT INTO role_permissions (role_id, permission_id) VALUES (1, 1), (2, 1);

-- now we have 2 roles with same permission
-- we need to add roles to users in organization
-- our user will have both roles
INSERT INTO user_roles (role_id, organization_id, user_id) VALUES (1, 1, 1), (2, 1, 1);

-- now we have 1 user who have 2 roles in 1 organization

In Laravel we can build BelongsToMany relation:


use App\Models\Organization;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class User extends Model
{
...

    public function getOrganizationsWithPermission($permission_id): BelongsToMany
    {
        return $this->belongsToMany(Organization::class, 'user_roles', 'user_id', 'organization_id')
            ->join('roles', 'roles.id', '=', 'user_roles.role_id')
            ->join('role_permissions', 'role_permissions.role_id', '=', 'roles.id')
            ->join('permissions', 'permissions.id', '=', 'role_permissions.permission_id')
            ->where('permissions.id', '=', $permission_id)
            ->distinct();
    }

...

If we run this query we will get normal result. But If we need append pagination we will have problem with that (see Description).

View more
2 comments
zubosem

zubosem

20th Sep 2023 @ 23:04

help wanted

Currently, for plural rules, the MessageFormatter polyfills uses the English rules for all locales (it ignores the locale). To be consistent with what we do in symfony/intl (used by symfony/polyfill-intl-icu to implement NumberFormatter and DateFormatter), we should rather fail explicitly here (using the English rules for a different locale would not give the right result anyway)

View more
2 comments
stof

stof

23rd Oct 2018 @ 15:34

good first issue help wanted

I'm getting thousands of these messages since upgrading to PHP8.2:

Creation of dynamic property Illuminate\Console\Scheduling\Event::$graceTimeInMinutes is deprecated in ...

I'm sorry that I don't really have much to offer other than our usage which is:

protected function schedule(Schedule $schedule)
    {
        $schedule->command('sendEmails')->everyMinute()->graceTimeInMinutes(10);
        $schedule->command('sendPartnerEmails')->everyMinute()->graceTimeInMinutes(45);
    }
View more
2 comments
raray

raray

21st Aug 2023 @ 18:58

enhancement help wanted hacktoberfest

Found the \Illuminate\Database\Eloquent\Concerns\HasAttributes::originalIsEquivalent() method during code diving and it should be usable for our trait! 🎉 This PR would be mainly reasearch when that method was added, if it's compatible with our version support rules and switching our own change detection logic with the core one.

View more
3 comments
Gummibeer

Gummibeer

20th Oct 2021 @ 10:03

enhancement help wanted good first issue

Server is down with 503 error when loading big pdf(8Mb, 40 pages). It's because you puting file in construct method Imagick.

$this->imagick = new Imagick($pdfFile);

But why whole file if i need only one page. In method getImageData there is instruction that page is need use for generate preview.

$this->imagick->readImage(sprintf('%s[%s]', $this->pdfFile, $this->page - 1));

If you need read all file don't indicate index of page. Like this:

$this->imagick->readImage($this->pdfFile);

After then i deleted file from constructor Imagick

$this->imagick = new Imagick();

And all works fine. If you want pick another page there is method setPage

View more
2 comments
truechernyshov

truechernyshov

11th Jan 2020 @ 10:59

help wanted findapr

I'm using Laravel 10. I've installed the package via "composer require php-flasher/flasher-laravel" Now I'm able to fire flash messages in my controller. I see them in the session data (in flasher::envelopes). But they aren't showing up in my views. In my config file I have 'auto_render' => true. If I put @flasher_render in my blade view, the only thing that's happens is, a notification to warn that this method wil be deprecated.

How can I fix this? I really like to use this package ;-)

View more
3 comments
krisc78

krisc78

9th Mar 2023 @ 14:49

bug help wanted good first issue

Describe the bug Trait Spatie\Activitylog\Traits\LogsActivity on line 371 tries to call getStorableEnumValue method on an Eloquent model. package.json file of the spatie/laravel-activitylog repository requires Laravel version ^8.0 || ^9.0 || ^10.0, but for example in Laravel 9.26.0 there was no getStorableEnumValue method implemented yet. It was added later. For example it is present in Laravel 9.52.15.

To Reproduce Create a new Laravel 9.0.0 app (not newer version!) Then install Spatie Laravel Activity Log. Then reproduce steps here: https://spatie.be/docs/laravel-activitylog/v4/advanced-usage/logging-model-events You will end up with the Call to undefined method App\\Models\\SomeModel::getStorableEnumValue() exception.

Expected behavior It should automatically upgrade my Laravel app to proper version. 9.0.0 is not new enough. You should change the minimal Laravel version in package.json.

Versions (please complete the following information)

  • PHP: 8.1
  • Laravel: 9.26.0
  • Package: spatie/laravel-activitylog

Additional context I faced this issue in Laravel 9.26.0. Then I simply upgraded my app with $ composer update. Then my Laravel version raised to 9.52.15 and the problem disappeared. So I suppose that the Laravel developers added getStorableEnumValue somewhere between version 9.26.0 and 9.52.15.

View more
3 comments
mspiderv

mspiderv

22nd Aug 2023 @ 17:12

help wanted

Ray allows for a meta.project_name to be set for when you use a separate Ray window for each project.

View more
riasvdv

riasvdv

21st Mar 2022 @ 08:49

help wanted

When calling mb_convert_encoding() with $fromEncoding === 'HTML-ENTITIES', the polyfill does not return functionally equivalent strings to the native function. This is because mb_convert_encoding() uses html_entity_decode() when $fromEncoding === 'HTML-ENTITIES' and that function does not return characters for many numeric entities 0-31 and 127-159. For example:

<?php

require "vendor/symfony/polyfill-mbstring/Mbstring.php";

use Symfony\Polyfill\Mbstring as p;

for($i = 0; $i < 1024; $i++) {
	$string = "&#" . $i . ";";
	$mbstring = mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES');
	$polyfill = p\Mbstring::mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES');
	if($mbstring != $polyfill) {
		echo "Mismatch: $string - mbstring: $mbstring; polyfill: $polyfill\n";
	}
}

outputs:

Mismatch: &#0; - mbstring: ; polyfill: &#0;
Mismatch: &#1; - mbstring: ; polyfill: &#1;
Mismatch: &#2; - mbstring: ; polyfill: &#2;
Mismatch: &#3; - mbstring: ; polyfill: &#3;
Mismatch: &#4; - mbstring: ; polyfill: &#4;
Mismatch: &#5; - mbstring: ; polyfill: &#5;
Mismatch: &#6; - mbstring: ; polyfill: &#6;
Mismatch: &#7; - mbstring: ; polyfill: &#7;
Mismatch: &#8; - mbstring:; polyfill: &#8;
Mismatch: &#11; - mbstring:
                            ; polyfill: &#11;
Mismatch: &#12; - mbstring:
                            ; polyfill: &#12;
Mismatch: &#14; - mbstring: ; polyfill: &#14;
Mismatch: &#15; - mbstring: ; polyfill: &#15;
Mismatch: &#16; - mbstring: ; polyfill: &#16;
Mismatch: &#17; - mbstring: ; polyfill: &#17;
Mismatch: &#18; - mbstring: ; polyfill: &#18;
Mismatch: &#19; - mbstring: ; polyfill: &#19;
Mismatch: &#20; - mbstring: ; polyfill: &#20;
Mismatch: &#21; - mbstring: ; polyfill: &#21;
Mismatch: &#22; - mbstring: ; polyfill: &#22;
Mismatch: &#23; - mbstring: ; polyfill: &#23;
Mismatch: &#24; - mbstring: ; polyfill: &#24;
Mismatch: &#25; - mbstring: ; polyfill: &#25;
Mismatch: &#26; - mbstring: ; polyfill: &#26;
Mismatch: &#27; - mbstring:  polyfill: &#27;
Mismatch: &#28; - mbstring: ; polyfill: &#28;
Mismatch: &#29; - mbstring: ; polyfill: &#29;
Mismatch: &#30; - mbstring: ; polyfill: &#30;
Mismatch: &#31; - mbstring: ; polyfill: &#31;
Mismatch: &#39; - mbstring: '; polyfill: &#39;
Mismatch: &#127; - mbstring: ; polyfill: &#127;
Mismatch: &#128; - mbstring: €; polyfill: &#128;
Mismatch: &#129; - mbstring: ; polyfill: &#129;
Mismatch: &#130; - mbstring: ‚; polyfill: &#130;
Mismatch: &#131; - mbstring: ƒ; polyfill: &#131;
Mismatch: &#132; - mbstring: „; polyfill: &#132;
Mismatch: &#133; - mbstring: …; polyfill: &#133;
Mismatch: &#134; - mbstring: †; polyfill: &#134;
Mismatch: &#135; - mbstring: ‡; polyfill: &#135;
Mismatch: &#136; - mbstring: ˆ; polyfill: &#136;
Mismatch: &#137; - mbstring: ‰; polyfill: &#137;
Mismatch: &#138; - mbstring: Š; polyfill: &#138;
Mismatch: &#139; - mbstring: ‹; polyfill: &#139;
Mismatch: &#140; - mbstring: Œ; polyfill: &#140;
Mismatch: &#141; - mbstring: ; polyfill: &#141;
Mismatch: &#142; - mbstring: Ž; polyfill: &#142;
Mismatch: &#143; - mbstring: ; polyfill: &#143;
Mismatch: &#144; - mbstring: ; polyfill: &#144;
Mismatch: &#145; - mbstring: ‘; polyfill: &#145;
Mismatch: &#146; - mbstring: ’; polyfill: &#146;
Mismatch: &#147; - mbstring: “; polyfill: &#147;
Mismatch: &#148; - mbstring: ”; polyfill: &#148;
Mismatch: &#149; - mbstring: •; polyfill: &#149;
Mismatch: &#150; - mbstring: –; polyfill: &#150;
Mismatch: &#151; - mbstring: —; polyfill: &#151;
Mismatch: &#152; - mbstring: ˜; polyfill: &#152;
Mismatch: &#153; - mbstring: ™; polyfill: &#153;
Mismatch: &#154; - mbstring: š; polyfill: &#154;
Mismatch: &#155; - mbstring: ›; polyfill: &#155;
Mismatch: &#156; - mbstring: œ; polyfill: &#156;
Mismatch: &#157; - mbstring: ; polyfill: &#157;
Mismatch: &#158; - mbstring: ž; polyfill: &#158;
Mismatch: &#159; - mbstring: Ÿ; polyfill: &#159;

While many of these are control characters (and the native function does return them), the single quote (dec 39) is particularly problematic.

View more
1 comment
cpeel

cpeel

18th Mar 2021 @ 04:11

help wanted

Laravel Version

10.23.1

PHP Version

8.1

Database Driver & Version

MariaDB 10.6.14

Description

I currently found a bug at our production servers, which leads to the fact that our job pipeline stopped. We dispatch a batch with many jobs, these jobs are running a database transaction. If a job fails because of a timeout (while being stuck in a transaction), the failed_jobs counter of the batch will not be increased.

Pre-analysis

To detect a timeout a pcntl alarm is used to kill the process. https://github.com/laravel/framework/blob/bfa85b811cf6545dd5b6be40b44a523d02897da9/src/Illuminate/Queue/Worker.php#L214 This opens like a second thread which will mark the job as failed and increment the batch failed jobs counter. The SQL query on the batch table will also run in a transaction. https://github.com/laravel/framework/blob/bfa85b811cf6545dd5b6be40b44a523d02897da9/src/Illuminate/Bus/DatabaseBatchRepository.php#L186 For some reason unknown to me, these two transactions from different threads get in each other's way, causing the batch transaction to be rolled back. (The mysql exporter shows a transaction savepoint in this moment)

Steps To Reproduce

  1. Create a Job which will timeout in a transaction
class TimeoutJob implements ShouldQueue
{

    use Batchable;
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;
    
    public int $tries = 1;
    public int $timeout = 5;

    public function handle(): void
    {
        DB::transaction(fn() => sleep(999));
    }

}
  1. Dispatch this job in a batch
Bus::batch([new TimeoutJob(), new TimeoutJob(), new TimeoutJob()])
  ->allowFailures()
  ->dispatch()
  1. See results image image image image
View more
2 comments
NiroDeveloper

NiroDeveloper

14th Sep 2023 @ 07:11

help wanted

When encountering nested tokens, they are parsed only during formatting, not when compiling the pattern. And the type of tokens are validated only during the rendering as well. But the native implementation detects such error during the instantiation: https://3v4l.org/Sf69D This means that the error handling required for the polyfill is not the same than for the native implementation.

View more
stof

stof

23rd Oct 2018 @ 15:58

help wanted hacktoberfest good first issue documentation

We are logging activity of several models, some using SoftDeletes trait and others not.

When we set config option 'subject_returns_soft_deleted_models' => true then calling subject() on any model not using SoftDeletes trait throws an exception: Call to undefined method Illuminate\Database\Eloquent\Builder::withTrashed().

Can the subject() method below be made to check first whether the Model uses the SoftDeletes trait? Or perhaps check whether withTrashed() is a defined method on the Model? I tried a few things but couldn't figure out how to get the class of the Model..

https://github.com/spatie/laravel-activitylog/blob/68eb6e65382f94fe86ce5ff6572159f80d024ba9/src/Models/Activity.php#L28-L35

View more
26 comments
bluec

bluec

7th Nov 2018 @ 13:44

bug help wanted

When attempting to filter tests by test or file name pressing the "Enter" key has no effect.

Pressing "Enter" at the default screen correctly triggers a "test run" where all tests are run.

View more
4 comments
ntwb

ntwb

25th Feb 2018 @ 10:49

enhancement help wanted good first issue

Describe the bug logUnguarded() works provided that $guarded is set explicitly in the model. If it is not set explicitly but globally set, say in AppServiceProvider using Model::unguard(); then nothing is logged.

To Reproduce

  1. remove $fillable and $guarded from a model that use uses LogsActivity
  2. call Model::unguard(); in AppServiceProvider in the boot method
  3. set
    public function getActivitylogOptions() : LogOptions
    {
        return LogOptions::defaults()->logUnguarded();
    }
  1. Make some changes to a model and save them

Expected behavior Some changed properties should be logged but none are

Versions (please complete the following information)

  • PHP: 8.1
  • Database: MySql
  • Laravel: 9.38
  • Package: larvel-activitylog
View more
1 comment
colinmackinlay

colinmackinlay

20th Nov 2022 @ 12:31

help wanted

Hello,

I noticed that there is an incompatibility with the mbstring polyfill and PHP 8.1 / Alpine Linux, which breaks a lot of my projects as soon as the php81-mbstring is not installed, but php81-iconv is installed:

Example:

Warning: iconv(): Wrong encoding, conversion from "ASCII" to "UTF-8//IGNORE" is not allowed in phar:///var/www/localhost/htdocs/phpstan.phar/vendor/symfony/polyfill-mbstring/Mbstring.php on line 736

It looks like //IGNORE is not accepted since echo iconv('UTF-8', 'UTF-8', 'test'); works, while echo iconv('UTF-8', 'UTF-8//IGNORE', 'test'); doesn't

View more
2 comments
danielmarschall

danielmarschall

7th Jan 2022 @ 00:12

help wanted

Laravel Version

10.18.0

PHP Version

8.2.3

Database Driver & Version

No response

Description

A job that is released back to the queue (e.g. by WithoutOverlap) does not acquire the UniqueLock and therefore does not prevent new jobs implementing the ShouldBeUnique interface from being added to the queue.

Context

We have a job that runs for ~10 seconds, goes through the content of our app and updates something in a cache. This job is triggered by various event listeners and therefore is not run in a regular interval. Because the job updates the cache for all content, there only ever needs to be one job in the queue to keep the cache up to date. This is why we updated our job to implement the ShouldBeUnique interface. However, this can result in an outdated cache, because no new job is pushed to the queue if a job is already being processed. That's why we wanted to update the job to implement the ShouldBeUniqueUntilProcessing interface and the WithoutOverlap middleware. That way, a new job would be added to the queue if one is already being processed, but no two jobs would be processed simultaneously, because that could lead to issues. Instead, they would be released back to the queue. It seems that ShouldBeUniqueUntilProcessing and WithoutOverlap do not work together as we expect it to.

Details

TestJob takes about 10 seconds to process and we have two workers running (using horizon).

Expected flow
  1. TestJob 1 is dispatched and added to the queue
  2. TestJob 1 is being processed by worker 1
  3. TestJob 2 is dispatched and added to the queue
  4. TestJob 2 is popped by worker 2 and released back to the queue
  5. TestJob 3 is dispatched and should be discarded, because the released TestJob 2 is already in the queue
  6. TestJob 2 is popped by a worker and processed (when TestJob 1 has finished processing)
Actual flow
  1. TestJob 1 is dispatched and added to the queue
  2. TestJob 1 is being processed by worker 1
  3. TestJob 2 is dispatched and added to the queue
  4. TestJob 2 is popped by worker 2 and released back to the queue
  5. TestJob 3 is dispatched and added to the queue
  6. TestJob 3 is being processed by worker 2
  7. TestJob 2 is popped by worker 1 and processed (when TestJob 1 has finished processing)
Question

Is the actual behaviour intended and our expectation is wrong, or is this an actual issue?

Steps To Reproduce

We have horizon running with two processes.

class TestJob implements ShouldQueue, ShouldBeUniqueUntilProcessing
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $tries = 0;

    public function __construct(
        public string $jobId
    ) {
    }

    public function middleware(): array
    {
        return [(new WithoutOverlapping())->releaseAfter(8)];
    }

    /**
     * Execute the job.
     */
    public function handle(): void
    {
        sleep(10);
    }

    public function getJobId(): string
    {
        return $this->jobId;
    }

    public function tags()
    {
        return [$this->getJobId(), "test-job:{$this->getJobId()}"];
    }
}
Event::listen(JobProcessing::class, function (JobProcessing $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} processing");
});

Event::listen(JobFailed::class, function (JobFailed $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} failed");
});

Event::listen(JobPopped::class, function (JobPopped $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} popped from queue");
});

Event::listen(JobProcessed::class, function (JobProcessed $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} processed");
});

Event::listen(JobQueued::class, function (JobQueued $event) {
    $jobName = class_basename($event->job);
    logger()->debug("{$jobName} {$event->job->getJobId()} queued");
});

Event::listen(JobReleasedAfterException::class, function (JobReleasedAfterException $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} released after exception");
});

Event::listen(JobRetryRequested::class, function (JobRetryRequested $event) {
    $jobName = class_basename($event->job);
    logger()->debug("{$jobName} {$event->payload()['tags'][0]} requested a retry");
});

Event::listen(JobTimedOut::class, function (JobTimedOut $event) {
    $jobName = class_basename($event->job->resolveName());
    logger()->debug("{$jobName} {$event->job->payload()['tags'][0]} timed out");
});

Test

Route::get('/issue', function () {
    // should be started after 2 seconds
    dispatch((new TestJob('01'))->delay(now()->addSeconds(2)));

    sleep(6);

    // should be started after job 1 is completed
    dispatch(new TestJob('02'));

    sleep(8);

    // should not be started because job 2 is still in the queue and not processing
    dispatch(new TestJob('03'));

    return 'Jobs dispatched '.now()->toDateTimeString();
});

Issue: Job 2 is released back to the queue. Job 3 however is still added to the queue, even though job 2 is now in the queue (to be processed after 8 seconds) again.

Log

[2023-08-09 12:12:43] local.DEBUG: TestJob 01 queued
[2023-08-09 12:12:45] local.DEBUG: TestJob 02 processed
[2023-08-09 12:12:45] local.DEBUG: TestJob 01 popped from queue
[2023-08-09 12:12:45] local.DEBUG: TestJob 01 processing
[2023-08-09 12:12:49] local.DEBUG: TestJob 02 queued
[2023-08-09 12:12:50] local.DEBUG: TestJob 02 popped from queue
[2023-08-09 12:12:50] local.DEBUG: TestJob 02 processing
[2023-08-09 12:12:50] local.DEBUG: TestJob 02 processed
[2023-08-09 12:12:55] local.DEBUG: TestJob 01 processed
[2023-08-09 12:12:57] local.DEBUG: TestJob 03 queued
[2023-08-09 12:12:58] local.DEBUG: TestJob 03 popped from queue
[2023-08-09 12:12:58] local.DEBUG: TestJob 03 processing
[2023-08-09 12:12:59] local.DEBUG: TestJob 02 popped from queue
[2023-08-09 12:12:59] local.DEBUG: TestJob 02 processing
[2023-08-09 12:12:59] local.DEBUG: TestJob 02 processed
[2023-08-09 12:13:08] local.DEBUG: TestJob 03 processed
[2023-08-09 12:13:08] local.DEBUG: TestJob 02 popped from queue
[2023-08-09 12:13:08] local.DEBUG: TestJob 02 processing
[2023-08-09 12:13:18] local.DEBUG: TestJob 02 processed
View more
3 comments 👀 6
Buffalom

Buffalom

9th Aug 2023 @ 14:04

enhancement help wanted

Hi! If I use this package with my project I has a problem. My package.json has a "git dependency" like this:

{
  "peerDependencies": {
    "package": "git+ssh://git@bitbucket.org/team/project.git"
  }
}

And npm-install-peers breaks.

View more
👍 5
JWo1F

JWo1F

18th Dec 2017 @ 08:52

help wanted

In raising this issue, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • I have checked that the bug-fix I am reporting can be replicated.

Description of the problem

One of the important reasons for using hyperscript is that it handles escaping of characters which are reserved in html. Which prevents XSS.

spatie/html-element does not do this. Mainly because it uses strings as intermediate format instead of an object representation of the DOM.

View more
6 comments 👍 3
Erikvv

Erikvv

1st Feb 2018 @ 02:19

bug help wanted

What happened?

After installation, I noticed that in the browser console it outputs an error of wireEl is undefined.

How to reproduce the bug

Just install this package in a livewire project, preferable with Filament's admin package. And see the browser console.

composer create-project laravel/laravel test;
composer require filamentphp/filament;
composer require spatie/laravel-blade-comments;

Then go through the browser console and see the error

Package Version

1.0.1

PHP Version

8.2.0

Laravel Version

10.13.0

Which operating systems does with happen with?

macOS

Notes

Filament ......................................................
Packages ...... filament, forms, notifications, support, tables
Version .............................................. v2.17.44
Views ..................................... PUBLISHED: filament

View more
4 comments
sawirricardo

sawirricardo

2nd Jun 2023 @ 07:15

enhancement help wanted

Figure our a way to show a grayed out Laravel logo as a default avatar instead of the current default GitHub one.

View more
3 comments
driesvints

driesvints

29th Sep 2021 @ 10:48

help wanted

Hi,

With the polyfill, var_dump(mb_strlen(chr(254))) return 0. With the php8.0-mbstring extension, var_dump(mb_strlen(chr(254))) return 1;

versions : * v1.26.0

Thanks, Alex

View more
7 comments
alexchuin

alexchuin

18th Oct 2022 @ 12:51

help wanted

Add in PHP 7.3 as Normalizer::normalize() argument for NFKC_Casefold normalization.

View more
1 comment
nicolas-grekas

nicolas-grekas

7th Feb 2019 @ 10:11

help wanted

Laravel Version

10.24.0

PHP Version

8.2.8

Database Driver & Version

8.0.31-0ubuntu0.20.04.2 (Homestead)

Description

I am using the Amazon RDS database. When the master database fails over to slave, the master database is set by Amazon to read-only mode. I am running queue workers with a database driver. Queue worker gets the exception that it can't write to the database anymore. The queue worker doesn't quit, it just retries the same query. If the queue worker would quit, the supervisor would start a new one and it would get the new MySQL connection that is writable.

Steps To Reproduce

  1. write at least one queue job to the jobs table
  2. set MySQL into read-only mode DB::statement("ALTER DATABASE database_name READ ONLY = 1;");
  3. run artisan queue:work

What is the problem? In the Laravel logs, I get this error: [2023-09-21 14:04:22] local.ERROR: SQLSTATE[HY000]: General error: 3989 Schema 'go' is in read-only mode. (Connection: MySQL, SQL: select * from jobs where queue = default and ((reserved_at is null and available_at <= 1695305061) or (reserved_at <= 1695294261)) order by id asc limit 1 FOR UPDATE SKIP LOCKED)... And the worker doesn't quit after the error. And keeps retrying the same query indefinitely not processing any jobs.

What do I expect? After such an error I expect a worker to quit.

It is probably not a very big problem, because queue jobs can be run not in "daemon" mode. Which avoids this problem.

View more
1 comment
mantas-done

mantas-done

21st Sep 2023 @ 14:17

good first issue

Hello!

Using the PHP attribute \Spatie\EventSourcing\Attributes\EventSerializer it is possible to set a specific serializer for an event. This works well for deserializing the event, but not on serialize.

Because \Spatie\EventSourcing\EventSerializers\EventSerializer defines serialize in its interface I would consider this a bug.

Please also use the specified serializer on serialize of the events.

View more
philipp-kern

philipp-kern

6th Jun 2023 @ 13:42

enhancement help wanted

Filter out any duplicates with:

SELECT
    github_username,
    COUNT(github_username)
FROM
    users
GROUP BY
    github_username
HAVING
    COUNT(github_username) > 1;

SELECT
    *
FROM
    users
WHERE
    github_username = 'duplicate';

These can actually be synced from their GitHub ID. We should run a queued job that goes over all accounts and syncs them. Maybe also a scheduled job or a GitHub webhook.

View more
4 comments
driesvints

driesvints

31st Jul 2021 @ 18:43

bug help wanted

What happened?

I have the following include:

@include('components.copy-to-clipboard', ['text' => $token, 'tooltip' => __('Copy API Token'), 'toast' => 'Token copied to clipboard',])

Due to the use of __() the IncludeCommenter broke the view compilation. In the compiled view I see:

<!-- Start include: components.copy-to-clipboard', ['text' => $token, 'tooltip' => __('Copy API Token --><?php echo $__env->make('components.copy-to-clipboard', ['text' => $token, 'tooltip' => __('Copy API Token')<!-- End include: components.copy-to-clipboard', ['text' => $token, 'tooltip' => __('Copy API Token -->, 'toast' => 'Token copied to clipboard',], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

and I get the following syntax error:

syntax error, unexpected token "include", expecting "->" or "?->" or "{" or "["

It looks like it sees the closing parenthesis of the translation function and decided that was the end of the include. But it's not. Replacing the __() call with a plain string fixes the issue, confirming that that is indeed the cause.

How to reproduce the bug

See above

Package Version

1.0.3

PHP Version

8.1.x

Laravel Version

10.13.0

Which operating systems does with happen with?

Linux

Notes

No response

View more
2 comments
bjhijmans

bjhijmans

8th Aug 2023 @ 13:31

help wanted

Laravel Version

10.24.0

PHP Version

irrelevant

Database Driver & Version

irrelevant

Description

When multiple connections are specified in $connectionsToTransact (default value: [null]), any callback functions specified in DB::afterCommit() will not be executed.

Steps To Reproduce

<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class ExampleTest extends TestCase
{
    protected $connectionsToTransact = [null, 'sqlite'];

    use RefreshDatabase;

    public function testExample(): void
    {
        $executed = false;

        DB::transaction(function () use (&$executed) {
            DB::afterCommit(function () use (&$executed) {
                $executed = true;
            });
        });

        $this->assertTrue($executed);
    }
}
View more
5 comments
mpyw

mpyw

20th Sep 2023 @ 12:46