|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 1703 | minor | always | 04-23-07 20:19 | 04-24-07 09:41 | |
|
|
|||||
| Reporter: | snb | Platform: | |||
| Assigned To: | nam | OS: | |||
| Priority: | normal | OS Version: | |||
| Status: | closed | Product Version: | 3.1.1 | ||
| Product Build: | Resolution: | fixed | |||
| Projection: | none | ||||
| ETA: | none | Fixed in 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. |
||||
| Steps To Reproduce: | |||||
| Additional Information: | |||||
| Relationships | |||||
| Attached Files: | |||||
| Notes | |||||
|
|
|||||
|
|
||||