php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47456 Missing PCRE option 'J'
Submitted: 2009-02-19 23:12 UTC Modified: 2016-09-05 08:29 UTC
Votes:7
Avg. Score:3.9 ± 1.5
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:4 (66.7%)
From: rodricg at sellingsource dot com Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 5.3CVS-2009-02-19 (CVS) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rodricg at sellingsource dot com
New email:
PHP Version: OS:

 

 [2009-02-19 23:12 UTC] rodricg at sellingsource dot com
Description:
------------
The PCRE extension does not recognize the 'J' option for setting PCRE_DUPNAMES.

Reproduce code:
---------------
<?php
preg_match_all('/(?<chr>[ac])(?<num>\d)|(?<chr>[b])/J', 'a1bc3', $m, PREG_SET_ORDER);
print_r($m);
?>


Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => a1
            [chr] => a
            [1] => a
            [num] => 1
            [2] => 1
        )
    [1] => Array
        (
            [0] => b
            [chr] => b
            [1] =>
            [num] =>
            [2] =>
            [3] => b
        )
    [2] => Array
        (
            [0] => c3
            [chr] => c
            [1] => c
            [num] => 3
            [2] => 3
        )
)


Actual result:
--------------
PHP Warning:  preg_match(): Unknown modifier 'J' in ....

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-19 23:36 UTC] felipe@php.net
Currently you can only use PCRE_INFO_JCHANGED by (?J) in the pattern. I have suggested times ago to the maintainer, but it wasn't accept the addiction of 'J' as valid modifier in the extension.

Anyway, assigned to maintainer.
 [2009-02-19 23:47 UTC] rodricg at sellingsource dot com
Didn't see how else to include this diff for php_pcre.c
http://diff.pastebin.com/f5639d5a5
 [2010-12-20 14:26 UTC] jani@php.net
-Package: Feature/Change Request +Package: PCRE related
 [2012-01-20 19:43 UTC] nlopess@php.net
-Status: Assigned +Status: Open -Assigned To: nlopess +Assigned To:
 [2016-09-05 08:29 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2016-09-05 08:29 UTC] cmb@php.net
Implemented: <https://github.com/php/php-src/commit/c4fe264b>.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 09:01:29 2019 UTC