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: fix deprecation notice #3250

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Feb 28, 2021

The Util\Standards::getInstalledStandardPath() method returns either a string or null, however the strpos() method which is used in both the Util\Common::isPharFile() method, as well as in the follow-on condition, only accepts a string as $haystack.

As of PHP 8.1, this will generate a deprecation notice strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated.

Discovered while testing an external standard against PHPCS master on PHP 8.1.

Fixed now.

The `Util\Standards::getInstalledStandardPath()` method returns either a string or `null`, however the `strpos()` method which is used in both the `Util\Common::isPharFile()` method, as well as in the follow-on condition, only accepts a `string` as `$haystack`.

As of PHP 8.1, this will generate a deprecation notice `strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated`.

Discovered while testing an external standard against PHPCS `master` on PHP 8.1.

Fixed now.
@gsherwood
Copy link
Member

Nice find, thanks

@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Mar 5, 2021
@gsherwood gsherwood added this to the 3.6.0 milestone Mar 5, 2021
@gsherwood gsherwood merged commit dcc1fe5 into squizlabs:master Mar 5, 2021
PHPCS v3 Development automation moved this from Idea Bank to Ready for Release Mar 5, 2021
@jrfnl jrfnl deleted the php-8.1/fix-deprecation-notice branch March 5, 2021 00:59
@jrfnl
Copy link
Contributor Author

jrfnl commented Mar 5, 2021

Thanks for merging this! Retriggering the build via which I found it now to see if it goes 🟢

@jrfnl
Copy link
Contributor Author

jrfnl commented Mar 5, 2021

Nope, still failing, now on a similar, but different error. Follow-up PR upcoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PHPCS v3 Development
Ready for Release
Development

Successfully merging this pull request may close these issues.

None yet

2 participants