Fixed PHP 8.1 [E_DEPRECATED] urldecode(): Passing null to parameter #1 ($string) of type string

TickTackk

Well-known member
Affected version
2.2.8 P1
When adding route filter:
Code:
Template admin:route_filter_edit: [E_DEPRECATED] urldecode(): Passing null to parameter #1 ($string) of type string is deprecated (src/XF/Entity/RouteFilter.php:25)
Template admin:route_filter_edit: [E_DEPRECATED] urldecode(): Passing null to parameter #1 ($string) of type string is deprecated (src/XF/Entity/RouteFilter.php:30)
 

FTL

Well-known member
PHP 8.1 isn't currently recommended for XF as it's not fully compatible with it, hence your errors. You should drop back to the latest 8.0.17.

An announcement will be made when XF officially supports PHP 8.1.
 

Kirby

Well-known member
My understanding of it is that it simply checks for the minimum version, not the maximum version.
I am not a XenForo developer, but that is exactly how the check is coded.
It is currently not recommended to run XenForo on PHP 8.1 in production, but related bug reports are appreciated.
 

bzcomputers

Well-known member
I am using php 8.1.4 version. but I have never encountered any errors. Why do you have mistakes I don't have mistakes

There are a many different reasons this could be happening. Here are a couple...

1) Your XenForo installation is not actively using the code that has the issue. Example: The issue is in the Avatar code and you have avatars disabled.
2) You are not looking in the right place for the errors. Not all errors will be displayed within XenForo itself, you may need to also check your server logs, which you may or may not have access to.
3) Your server is not setup to display or log all errors. Your server may be set to only display/log fatal errors and may be ignoring warnings and notices.

This is why you may think XenForo 2.2.8 is fully compatible with PHP 8.1 when it is not. It is still not recommended to run PHP 8.1 with XenForo outside of a test environment.

Since you are running XenForo on PHP 8.1 on a publicly active XenForo site your users may be experiencing some issues due to errors that you may not even be aware of. Continued usability problems from a website can turn users off and you can lose users and traffic due to this.

I expect XenForo to be fully compatibility with PHP 8.1 soon, but until then be aware just because you don't see or experience errors that your users may not be having a different experience.
 

PaulB

Well-known member
PHP 8.1 isn't currently recommended for XF as it's not fully compatible with it, hence your errors. You should drop back to the latest 8.0.17.

An announcement will be made when XF officially supports PHP 8.1.
There are numerous add-on developers—including @TickTackk—deliberately using PHP 8.1 during development so they can report bugs like these. That’s the best way to sort out PHP 8.1 compatibility for future XenForo releases.
 

FTL

Well-known member
There are numerous add-on developers—including @TickTackk—deliberately using PHP 8.1 during development so they can report bugs like these. That’s the best way to sort out PHP 8.1 compatibility for future XenForo releases.
Yes that helps, but our OP doesn't sound like a developer. From his post, just looks like a user with a problem who doesn't know about the compatibility issue.
 

PaulB

Well-known member
I think most of us have just gotten a bit lazy about how we report PHP 8.1 bugs; it’s often unnecessary to elaborate because they’re pretty distinct. You’ll likely see more reports like these from experienced devs.
 

FTL

Well-known member
I think most of us have just gotten a bit lazy about how we report PHP 8.1 bugs; it’s often unnecessary to elaborate because they’re pretty distinct. You’ll likely see more reports like these from experienced devs.
Lazy is the operative word, yes. It doesn't take much to start it off with, "I'm a dev testing php 8.1 and I've found this problem". Something like that would be nice and clear to everyone, avoiding conversations like these. In fact, I wouldn't have replied at all if I'd known this.
 

PaulB

Well-known member
These reports are really intended for the XenForo devs; they’re largely coming from the same small group of people, and the XF devs likely know we’re not really expecting a response or instructions for working around the issue. It’s easy to forget there are other people on these forums looking to help. ;)

I usually put “PHP 8.1” in the titles of my reports to make it clear I’m not expecting help, but the priority is really just making sure it’s reported. If I’m in a rush, I might forget to mention PHP 8.1.
 

Forsaken

Well-known member
Lazy is the operative word, yes. It doesn't take much to start it off with, "I'm a dev testing php 8.1 and I've found this problem". Something like that would be nice and clear to everyone, avoiding conversations like these. In fact, I wouldn't have replied at all if I'd known this.
Laziness = working on a large convoluted add-on and running into bugs, but still taking time to report them. He probably told @Chris D and posted this so it is tracked internally in between development of his own add-on, or customer add-ons.
 
Top