Bug #76909 [NEW]: preg_match difference between 7.3 and < 7.3
| From: | jay at diablomedia dot com | Date: | Thu, 20 Sep 2018 20:41:38 +0000 |
| Subject: | Bug #76909 [NEW]: preg_match difference between 7.3 and < 7.3 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217160@lists.php.net to get a copy of this message | ||
From: jay at diablomedia dot com
Operating system: Linux
PHP version: 7.3.0RC1
Package: *Regular Expressions
Bug Type: Bug
Bug description:preg_match difference between 7.3 and < 7.3
Description:
------------
I was testing a fork of Zend Framework 1 that we maintain for our legacy
applications against php 7.3.0rc1 and noticed the Zend_Validate
component's tests were failing on php 7.3:
https://travis-ci.org/diablomedia/zf1-validate/jobs/431170057
In this case, php 7.3 is allowing some hostnames through validation that
are being rejected in php < 7.3.
I dug a bit, and was able to reproduce this with a single regular
expression that is evaluated differently in php 7.3 than it is in php
5.6 through php 7.2.
Here's a link to 3v4l.org demonstrating the difference (script is in the
"Test script" section of this report): https://3v4l.org/DR3S5
Test script:
---------------
<?php
$domainPart = ' domain.com';
$regexChar = '/^[\x{0100}-\x{017f}]{1,63}$/iu';
preg_match($regexChar, $domainPart, $matches);
print_r($matches);
Expected result:
----------------
I would expect the $matches array in the test script to be empty here,
similar to all PHP versions before 7.3.
Actual result:
--------------
The regex matches on " domain.com", which it doesn't in earlier versions
of PHP.
--
Edit bug report at https://bugs.php.net/bug.php?id=76909&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76909&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76909&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76909&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76909&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76909&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76909&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76909&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76909&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76909&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76909&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76909&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76909&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76909&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76909&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76909&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76909&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76909&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76909&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76909&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76909&r=mysqlcfg