| Anonymous | Login | Signup for a new account | 10-28-2025 17:27 PDT |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ 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 | Platform | |||||
| Status | closed | OS | |||||||
| Projection | none | OS Version | |||||||
| ETA | none | Fixed in Version | 3.1.1 | Product Version | 3.1.1 | ||||
| Product Build | |||||||||
| 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 | |||||||||
| Attached Files | |||||||||
|
|
|||||||||
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |