Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e23fd9e

Browse filesBrowse files
bug #34632 [Console] Fix trying to access array offset on value of type int (Tavafi)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] Fix trying to access array offset on value of type int | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | yes | New feature? | no | Deprecations? | no |Tests pass?| yes | License | MIT PHP 7.4 throws an error exception when you are trying to access an array by an integer key. I got this error while I was running a console command: ``` ErrorException: Trying to access array offset on value of type int at /my/project/vendor/symfony/console/Input/ArrayInput.php:110 Exception trace: /my/project/vendor/symfony/console/Input/ArrayInput.php:110 /my/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /my/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /my/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /my/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /my/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /my/project/vendor/laravel/framework/src/Illuminate/Console/Command.php:179 /my/project/vendor/symfony/console/Command/Command.php:255 /my/project/vendor/laravel/framework/src/Illuminate/Console/Command.php:166 /my/project/vendor/symfony/console/Application.php:934 /my/project/vendor/symfony/console/Application.php:273 /my/project/vendor/symfony/console/Application.php:149 /my/project/vendor/laravel/framework/src/Illuminate/Console/Application.php:89 /my/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122 /my/project/artisan:37 ``` Commits ------- 069d214 [Console] Fix trying to access array offset on value of type int
2 parents 5cacc5d + 069d214 commit e23fd9e
Copy full SHA for e23fd9e

File tree

1 file changed

+3
-3
lines changed
Filter options

1 file changed

+3
-3
lines changed

‎src/Symfony/Component/Console/Input/ArrayInput.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/ArrayInput.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function __construct(array $parameters, InputDefinition $definition = nul
3939
*/
4040
public function getFirstArgument()
4141
{
42-
foreach ($this->parameters as $key => $value) {
43-
if ($key && '-' === $key[0]) {
42+
foreach ($this->parameters as $param => $value) {
43+
if ($param && \is_string($param) && '-' === $param[0]) {
4444
continue;
4545
}
4646

@@ -107,7 +107,7 @@ public function __toString()
107107
{
108108
$params = [];
109109
foreach ($this->parameters as $param => $val) {
110-
if ($param && '-' === $param[0]) {
110+
if ($param && \is_string($param) && '-' === $param[0]) {
111111
if (\is_array($val)) {
112112
foreach ($val as $v) {
113113
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.