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

PHP 8.1: getid3_quicktime::QuicktimeParseContainerAtom(): fix deprecation notice #337

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Aug 23, 2021

The $atom_structure is declared at the start of the method as false, but is subsequently assigned to as if it were an array in line 2122.

This will throw a deprecation notice as of PHP 8.1: Deprecated: Automatic conversion of false to array is deprecated in path/to/getid3/module.audio-video.quicktime.php on line 2122

Fixed now, by setting the initial value as an empty array, breaking out of the while instead of returning and checking whether the array is still empty at the end, and if so, returning false.

This should maintain the existing behaviour, but get round the deprecation notice.

Ref: https://wiki.php.net/rfc/autovivification_false

…tion notice

The `$atom_structure` is declared at the start of the method as `false`, but is subsequently assigned to as if it were an array in line 2122.

This will throw a deprecation notice as of PHP 8.1: `Deprecated: Automatic conversion of false to array is deprecated in path/to/getid3/module.audio-video.quicktime.php on line 2122`

Fixed now, by setting the initial value as an empty array, breaking out of the `while` instead of returning and checking whether the array is still empty at the end, and if so, returning `false`.

This should maintain the existing behaviour, but get round the deprecation notice.

Ref: https://wiki.php.net/rfc/autovivification_false
@JamesHeinrich JamesHeinrich merged commit 81c2efa into JamesHeinrich:master Aug 23, 2021
@jrfnl jrfnl deleted the feature/php-8.1-fix-false-to-array-deprecation branch August 23, 2021 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants