php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76975 preg_match difference between 7.3 and < 7.3 - II
Submitted: 2018-10-05 10:42 UTC Modified: 2018-10-05 19:52 UTC
From: mlocati at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 7.3.0RC2 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 40 = ?
Subscribe to this entry?

 
 [2018-10-05 10:42 UTC] mlocati at gmail dot com
Description:
------------
It seems that '/^[\\w-:]+$/' is no more a valid regular expression with PHP 7.3: we now have this error

Compilation failed: invalid range in character class at offset 4

I understand that this regex is malformed (I think that the original author of the affected regex may have meant '/^[\\w\\-:]+$/'), but it's a breaking change:
that regular expression worked for all the previous PHP versions (see https://3v4l.org/vD5O2 )



Test script:
---------------
<?php

$tag = 'p';

var_dump(preg_match('/^[\\w-:]+$/', $tag));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-05 17:48 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2018-10-05 17:48 UTC] requinix@php.net
See bug #76188
 [2018-10-05 19:52 UTC] cmb@php.net
-Status: Duplicate +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2018-10-05 19:52 UTC] cmb@php.net
Since this is the third time (at least) that this has been
reported, we should explicitly mention it in UPGRADING.
 [2018-10-06 09:07 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e345af1a2e9efbcd5919afeaadb2b8dbddcff4c1
Log: Fix #76975: preg_match difference between 7.3 and &lt; 7.3 - II
 [2018-10-06 09:07 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC