Fix deprecation when passing null as first parameter to array_key_exists#103
Fix deprecation when passing null as first parameter to array_key_exists#103Crell merged 2 commits intoCrell:masterfrom
null as first parameter to array_key_exists#103Conversation
phpunit.xml.dist
Outdated
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | |||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" failOnDeprecation="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | |||
There was a problem hiding this comment.
This is also off topic from the bug fix, I think. I'm fine with a separate issue/PR to discuss E_ALL and deprecations, but that should be separate from the bug fix itself. Thanks.
There was a problem hiding this comment.
I think is a reasonable thing. Initially the intent was to make the issue reproducible by running the tests against the first commit, because PHPUnit would still return code 0 with the deprecations.
Once I push the next changes, I'll take a moment to create a new issue, and then it can be tackled in its own scope.
There was a problem hiding this comment.
created #104 and removed most changes I originally pushed on the 1st commit, leaving only the essential to make the deprecation surface on the CI checks if ran against the first commit.
The current test suite already contains test cases that would trigger the deprecation. Therefore, this commit sets the .ini directive `error_reporting` to `E_ALL`, so these issues surface earlier.
This change fixes the situation whenever a call to `array_key_exists` with `$key` set to `null` would trigger a deprecation notice.
Description
This PR fixes a deprecation emitted when
$keyisnullwhen passed toarray_key_existsfunction.Motivation and context
In the context of adopting the library in a proof of concept, I encountered a deprecation notice and created #102 to follow up on it. This PR fixes #102
How has this been tested?
Existing test suite already covers this scenario, but is now made visible by running the tests with
error_reporting=E_ALL. can be confirmed by runningvendor/bin/phpuniton the first commit.Types of changes
What types of changes does your code introduce? Put an
xin all the boxes that apply:Checklist: