Skip to content

Commit

Permalink
bug #32806 [Console] fix warning on PHP 7.4 (rez1dent3)
Browse files Browse the repository at this point in the history
This PR was submitted for the 4.3 branch but it was squashed and merged into the 3.4 branch instead (closes #32806).

Discussion
----------

[Console] fix warning on PHP 7.4

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

In php 7.4rc, accessing an array by key, sometimes causes an error.
Rarely this error occurs on php 7.2.

```bash
ErrorException: Trying to access array offset on value of type int

/app/vendor/symfony/console/Input/ArrayInput.php:135
/app/vendor/symfony/console/Input/Input.php:55
/app/vendor/symfony/console/Application.php:208
/app/vendor/symfony/console/Application.php:149
/app/vendor/laravel/framework/src/Illuminate/Console/Application.php:90
/app/vendor/laravel/framework/src/Illuminate/Console/Application.php:182
/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:275
/app/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php:136
/app/vendor/orchestra/testbench-core/src/Database/MigrateProcessor.php:73
/app/vendor/orchestra/testbench-core/src/Database/MigrateProcessor.php:44
/app/vendor/orchestra/testbench-core/src/Concerns/WithLoadMigrationsFrom.php:27
```

Commits
-------

5f451e6 [Console] fix warning on PHP 7.4
  • Loading branch information
nicolas-grekas committed Jul 30, 2019
2 parents 5c67a67 + 5f451e6 commit 3f43186
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Input/ArrayInput.php
Expand Up @@ -132,7 +132,7 @@ protected function parse()
}
if (0 === strpos($key, '--')) {
$this->addLongOption(substr($key, 2), $value);
} elseif ('-' === $key[0]) {
} elseif (0 === strpos($key, '-')) {
$this->addShortOption(substr($key, 1), $value);
} else {
$this->addArgument($key, $value);
Expand Down

0 comments on commit 3f43186

Please sign in to comment.