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 deprecation warning #73

Closed
lee-peuker opened this issue Apr 25, 2022 · 5 comments
Closed

PHP 8.1 deprecation warning #73

lee-peuker opened this issue Apr 25, 2022 · 5 comments

Comments

@lee-peuker
Copy link

lee-peuker commented Apr 25, 2022

Hey, when executing the test with php 8.1.5 we get the following error:

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in .../vendor/byjg/uri/src/Uri.php on line 240

It seems like https://github.com/byjg/uri/pull/10/files#diff-c39fba9d7bfeaa6ed2cdf1cd5a05de305dcf28bd5ef11e7e44c06f3d4d473fc5 this was not enough 🤔

@byjg
Copy link
Owner

byjg commented Apr 25, 2022

Hey @lee-peuker, thank you for letting me know it.

Could you send the result of composer show? I am particularly interested if you can see the line:

byjg/uri                           2.1.2   An implementation of PSR UriInte...

The most recent Uri version is 2.1.2.

If that is not your version, try run composer update. If after update still failing please share with me the composer show | grep byjg and also the piece of code is failing, so I can try to reproduce it here.

@lee-peuker
Copy link
Author

lee-peuker commented Apr 26, 2022

Hey @byjg , thank you for the quick answer.

Version 2.1.2 is used, but this version still contains a deprecation issue here as far as I understand the depreciation warning https://github.com/byjg/uri/blob/master/src/Uri.php#L240

getFromArray can return null, but null as the third parameter for preg_replace is deprecated (see: https://www.php.net/manual/en/function.preg-replace.php)

Edit:
Oh and just for the sake of completeness

composer show | grep byjg
byjg/swagger-test                     3.1.4              A set of tools for testing your REST calls based on the Swagger or OpenAPI documentation using PHPUnit
byjg/uri                              2.1.2              An implementation of PSR UriInterface 
byjg/webrequest                       2.0.3              A lightweight and highly customized CURL wrapper for making RESt calls and a wrapper for call dynamically SOAP requests.

@byjg
Copy link
Owner

byjg commented Apr 27, 2022

Hello @lee-peuker ,

I found the issue. My Unit test wasn't getting warnings 🤦

Anyway, fix that and create a new version of URI. composer update will get the correct version 2.1.3.

Let me know if it worked.

@lee-peuker
Copy link
Author

Hey @byjg , you fixed it, thank you very much! ❤️

@byjg
Copy link
Owner

byjg commented Apr 28, 2022

Awesome! Glad to know it!

@byjg byjg closed this as completed Apr 28, 2022
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

No branches or pull requests

2 participants