Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.4.5-DEV |
There appears to be a bug here, but I haven't been able to figure out a solution.
The phpunit tests pass.
If I run bin/console cac:cl -e=dev
I'm seeing:
PHP Warning: strpos(): Empty needle in /var/www/api.codereviewvideos.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Input/ArgvInput.php on line 291
PHP Stack trace:
PHP 1. {main}() /var/www/api.codereviewvideos.dev/bin/console:0
PHP 2. Symfony\Component\Console\Input\ArgvInput->hasParameterOption() /var/www/api.codereviewvideos.dev/bin/console:21
PHP 3. strpos() /var/www/api.codereviewvideos.dev/vendor/symfony/symfony/src/Symfony/Component/Console/Input/ArgvInput.php:291
The bigger issue is:
In FileLocator.php line 44:
The file "/var/www/api.codereviewvideos.dev/app/config/config_=dev.yml" does not exist.
The =dev
bit being the problem.
I tracked this down to the change below in getParameterOption
.
return substr($token, strlen($leading));
Looking at the old code:
return substr($token, $pos + 1);
If I change to:
return substr($token, strlen($leading) + 1);
Then the command completes - but the strpos
warnings remain.
I added the following just before the new return
on line 321:
\Doctrine\Common\Util\Debug::dump([
'value' => $value,
'token' => $token,
'0 === strpos($value, "--")' => 0 === strpos($value, '--'),
'leading' => $leading,
'strlen($leading)' => strlen($leading),
'substr($token, strlen($leading))' => substr($token, strlen($leading) + 1),
]);
If I e.g. run the cache:clear
command again I see:
array (size=6)
'value' => string '-e' (length=2)
'token' => string '-e=dev' (length=6)
'0 === strpos($value, "--")' => boolean false
'leading' => string '-e' (length=2)
'strlen($leading)' => int 2
'substr($token, strlen($leading))' => string 'dev' (length=3)
Looks good.
Now if I run the tests I see 8 failures (provideGetParameterOptionValues
) e.g:
8) Symfony\Component\Console\Tests\Input\ArgvInputTest::testGetParameterOptionEqualSign with data set #13 (array('app/console', 'foo:bar', '--', '--env=dev'), '--env', false, 'dev')
->getParameterOption() returns the expected value
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'dev'
+'ev'
One extra thing, this only affects the short options (-e=dev
), using the longer form (--env=dev
) does not trigger this issue. However, the strpos(): Empty needle
issue occurs for both long and short form.
Sorry I haven't been able to figure this out, but I hope this helps in some way in tracking down the root cause. Thank you for your time.