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: PHP Deprecated: parse_str() #149

Closed
hasanparasteh opened this issue Dec 3, 2021 · 3 comments · Fixed by #150
Closed

PHP 8.1: PHP Deprecated: parse_str() #149

hasanparasteh opened this issue Dec 3, 2021 · 3 comments · Fixed by #150
Milestone

Comments

@hasanparasteh
Copy link

hasanparasteh commented Dec 3, 2021

When I run my ReactPHP project using PHP 8.1 I get the below warnings...please consider adding more strong support in the new version of PHP. I know PHP recently upgraded to 8.1 and I appreciate your hard works on this great project!

Using this function without the result parameter is highly DISCOURAGED and DEPRECATED as of PHP 7.2.
Link: PHP documentation on parse_str

Composer.json

"react/mysql": "^0.5.5"

Code

$databaseFactory = new Factory($loop);
$databaseFactory->createLazyConnection($databaseUri['appManager']);

Console

PHP Deprecated:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/react/mysql/src/Io/LazyConnection.php on line 37
@clue clue added the question label Dec 4, 2021
@clue clue added this to the v0.5.6 milestone Dec 4, 2021
@clue clue added new feature and removed question labels Dec 4, 2021
@clue clue mentioned this issue Dec 4, 2021
@clue
Copy link
Contributor

clue commented Dec 4, 2021

@hasanparasteh Thanks for bringing this up!

I've just filed #150 with some minimal changes to add PHP 8.1 support for this project.

Currently, it only reports a deprecation notice because we pass a possible null value from a parse_url() call to parse_str(). As of PHP 8.1 this requires an explicit type cast, but the code continues to function just fine despite the deprecation notice. This means using the current code base on PHP 8.1 works fine as long as you ignore the deprecation notice (which would be the default).

Expect a release some time in the next couple of weeks 👍

@hasanparasteh
Copy link
Author

Thank you @clue. I'll be glad If there's anything that I can help to fix this issue or other things related to PHP 8.1 in your next release

@clue
Copy link
Contributor

clue commented Dec 4, 2021

@hasanparasteh Thank you! Reporting issues is much appreciated and is always a good start to help us figure out what needs our attention.

We've intentionally designed our components to be both forward compatible and backward compatible as much as possible and have prepared PHP 8.1 in the past months, so fortunately addressing this one only required a minor change.

Happy to take a look if you find anything else that needs our attention 👍

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

Successfully merging a pull request may close this issue.

2 participants