[wp-trac] [WordPress Trac] #52397: The function wp_is_mobile should accept also lower case strings as user agents
WordPress Trac
noreply at wordpress.org
Sat Jan 30 09:28:24 UTC 2021
#52397: The function wp_is_mobile should accept also lower case strings as user
agents
-------------------------------+------------------------------
Reporter: giuse | Owner: (none)
Type: enhancement | Status: new
Priority: low | Milestone: Awaiting Review
Component: General | Version: 3.4
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by giuse):
I opened this thread because W3 Total Cache was giving problem to my
plugin that uses this function.
If you save the option related to the User Agent of W3 Total Cache, it
sanitizes it and it is saved "mobile" instead of "Mobile". I know this is
something that W3 Total Cache should solve, but my question is: What's the
problem in adding a strtolower? The performance would be the same, and you
would prevent issues with other plugins. Moreover, you never know if a
certain browser uses "mobile" instead of "Mobile". This function would be
more robust and prevent issues if it wasn't case sensitive.
I think it would be faster and easier adding strtolower than going ahead
commenting on this function, we are not speaking about something that is a
risk for performance or security, but if you don't add strtolower I will
replace this function with another one in my plugin, so if you don't want
to add strtolower, I suggest closing this thread.
Consider that also other plugins may replace this function, this would be
not good for the WP ecosystem if the reason is only a missing strtolower.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52397#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list