Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Console] Fix trying to access array offset on value of type int #34632

Merged

Conversation

eskylake
Copy link
Contributor

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

@stof
Copy link
Member

stof commented Nov 26, 2019

how does your ArrayInput looks like ? this is meant to be an array of strings, so why is there an integer there ?

@eskylake
Copy link
Contributor Author

@stof I am using lorisleiva/laravel-deployer.
I get this error when I run php artisan deploy --hosts='IP' -vvv.
The error happens when I pass -vvv.

@stof
Copy link
Member

stof commented Nov 26, 2019

OK, then we would have to see what artisan deploy does. It is probably the one instantiating an ArrayInput (the console itself is meant to use the ArgvInput implementation)

@nicolas-grekas nicolas-grekas changed the title [Console] Fixed: Trying to access array offset on value of type int [Console] Fix trying to access array offset on value of type int Nov 27, 2019
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, should target 3.4 actually.

src/Symfony/Component/Console/Input/ArrayInput.php Outdated Show resolved Hide resolved
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Nov 27, 2019
@nicolas-grekas nicolas-grekas changed the base branch from 5.0 to 3.4 November 28, 2019 09:04
@nicolas-grekas
Copy link
Member

Thank you @Tavafi.

nicolas-grekas added a commit that referenced this pull request Nov 28, 2019
…pe 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
@nicolas-grekas nicolas-grekas merged commit 069d214 into symfony:3.4 Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants