Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001703 [Quercus] minor always 04-23-07 20:19 04-24-07 09:41
Reporter snb View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.1.1
Summary 0001703: Not all named subpattern matches can be indexed by name in array set by preg_match_all()
Description preg_match_all() sets the array its third argument is a reference to to a set of matches, which I'll call $matches. When named subpatterns are used, $matches can be indexed by either the subpattern number or name if the subpatterns are named. With Quercus, it appears that the indices named for a subpattern aren't always added to $matches. Here's some example code:

<?php
$text = "<H2>some title</H2>";
$matches = array();
$numMatches = preg_match_all('/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)(?P<header&
gt;.*?)<\/H[1-6] *>/i', $text, $matches);
print_r($matches);
?>


Using PHP 5.2.1 this prints:

Array
(
    [0] => Array
        (
            [0] => <H2>some title</H2>
        )

    [level] => Array
        (
            [0] => 2
        )

    [1] => Array
        (
            [0] => 2
        )

    [attrib] => Array
        (
            [0] => >
        )

    [2] => Array
        (
            [0] => >
        )

    [header] => Array
        (
            [0] => some title
        )

    [3] => Array
        (
            [0] => some title
        )

)


But with Quercus the following is printed:

Array
(
    [0] => Array
        (
            [0] => <H2>some title</H2>
        )

    [1] => Array
        (
            [0] => 2
        )

    [header] => Array
        (
            [0] => 2
        )

    [2] => Array
        (
            [0] => >
        )

    [3] => Array
        (
            [0] => some title
        )

)


The values using numerical indexes are consistent, but Quercus doesn't include the attrib or level index names to $matches while PHP does.
Additional Information
Attached Files

- Relationships

- Notes
(0001858)
nam
04-24-07 09:41

php/152u
 

- Issue History
Date Modified Username Field Change
04-23-07 20:19 snb New Issue
04-24-07 09:37 nam Status new => assigned
04-24-07 09:37 nam Assigned To  => nam
04-24-07 09:41 nam Status assigned => closed
04-24-07 09:41 nam Note Added: 0001858
04-24-07 09:41 nam Resolution open => fixed
04-24-07 09:41 nam Fixed in Version  => 3.1.1


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker