simple-php-router icon indicating copy to clipboard operation
simple-php-router copied to clipboard

PHP 8.1 - Issues with type sensitivity

Open DeveloperMarius opened this issue 4 years ago • 1 comments

Hello @skipperbent,

this PR fixes the issue with php 8.1 reported by @AlexanderSchaller in #605. string 'strtolower(): Passing null to parameter #1 ($string) of type string is deprecated'

The issue is caused due to the fact that PHP 8 is more type sensitive than other php versions and added type sensitivity to a lot of php functions. All these functions are now deprecated and throw errors.

When somebody finds a php 8.1 related issue, please report it here until this PR is merged into master. When you provide the code snippet and detailed error message, I can have a look at it.

~ Marius

Edit: To ensure that the router works with PHP 8.1, here are some don't dos:

  • Don't use the ArrayAccess functionality with the InputItem. That means that you should not iterate through the InputItem object ($input) directly and better iterate through $input->getValue(). This issue was reported by @jorge-koki in #612.

DeveloperMarius avatar Feb 07 '22 13:02 DeveloperMarius

Hey,

after I added tests for PHP 8.1, I had to update PHPUnit to version 8 to support checks for PHP >= 7.2. Info: PHPUnit 7 is not supported anymore. We sould go to version 8. To do this we have to drop support for PHP 7.1

With this PR I just wanted to fix the issue explained above. I will remove the tests for PHP 8.1 and will move the tests to the PR #515.

~ Marius

DeveloperMarius avatar Feb 08 '22 21:02 DeveloperMarius