Alex
Alex

Reputation: 34998

Laravel causes PHP warning (exception not caught) xdebug enabled, otherwise all is fine

With xdebug enabled I can reproduce an error:

composer create-project laravel/laravel
cd laravel
composer require proengsoft/laravel-jsvalidation
php artisan vendor:publish --provider="Proengsoft\JsValidation\JsValidationServiceProvider" --tag=public

Error:

PHP Warning:  Uncaught League\Flysystem\Plugin\PluginNotFoundException: Plugin not found for method: read in /tmp/laravel/vendor/league/flysystem/src/Plugin/PluggableTrait.php:49

Stack trace:

But without xdebug enabled, everything runs fine.

I am wondering if this is happening only for me or also for others, before reporting it to xdebug.

php -v
PHP 7.1.15-1+ubuntu16.04.1+deb.sury.org+2


Package: php-xdebug
Version: 2.6.0+2.5.5-1+ubuntu16.04.1+deb.sury.org+1

Composer.lock for reference

https://gist.github.com/amenk/9d63975cf4aabf86288b79fb95e8156c

I tracked it down to the following function in Flysystem:

public function invokePluginOnFilesystem($method, $arguments, $prefix)
{
    $filesystem = $this->getFilesystem($prefix);

    try {
        return $this->invokePlugin($method, $arguments, $filesystem);
    } catch (PluginNotFoundException $e) {
        // Let it pass, it's ok, don't panic.
    }

    $callback = [$filesystem, $method];

    return call_user_func_array($callback, $arguments);
}

The exception is thrown in invokePlugin() but caught afterwars (if xdebug is off). It Xdebug is on, that does not work anymore.

I have a 1G memory limit for PHP-CLI in place.

Bug Reported: https://bugs.xdebug.org/view.php?id=1535

Upvotes: 1

Views: 409

Answers (2)

Alex
Alex

Reputation: 34998

Some more info / quick fix:

I was using

xdebug.collect_params=4

with

xdebug.collect_params=1

the bug does not appear.

Also the bug only appears after updating to PHP 7.1.15 - and it does not appear for PHP 7.2

There is also a warning about huge scripts in the docs:

https://xdebug.org/docs/all_settings

The setting defaults to 0 because for very large scripts it may use huge amounts of memory and therefore make it impossible for the huge script to run. You can most safely turn this setting on, but you can expect some problems in scripts with a lot of function calls and/or huge data structures as parameters. Xdebug 2 will not have this problem with increased memory usage, as it will never store this information in memory. Instead it will only be written to disk. This means that you need to have a look at the disk usage though.

Upvotes: 0

Derick
Derick

Reputation: 36784

This is not really a question, but a bug report. I can easily reproduce all kinds of wonkyness due to exceptions. Please file a bug report at https://bugs.xdebug.org — preferably with a lot smaller test case

Upvotes: 2

Related Questions