byjg/php-swagger-test

PHP 8.1 deprecation warning

lee-peuker opened this issue · 5 comments

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 commented

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.

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 commented

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.

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

byjg commented

Awesome! Glad to know it!