RSS Feed/News \XF\Data\Robot::userAgentMatchesRobot doesn't handle bots with # on php 7.2

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
33,289
Points
823

Reputation:

From ph 7.3+, preg_quote will escape the # character. But on php 7,2 it does not escape this.

Online PHP editor | output for nXR6e

Run your php code online; get statistics, vld output and compare output from all versions.
3v4l.org
3v4l.org

PHP:

Code:
        if (preg_match(
            '#(' . implode('|', array_map('preg_quote', array_keys($bots))) . ')#i',
            strtolower($userAgent),
            $match
        ))

Simple solution is to use / as the delimiter as that is escaped on all versions

Continue reading...
 
Status
Not open for further replies.
Top