|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-30 08:34 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ The (?{CODE}) regular expression has been in Perl since <= 5.005, and the PHP documentation for PCRE says that it's current as of 5.005. This functionality does not appear to be functional in PHP 5.2.9. Reproduce code: --------------- <? $pattern = '/^(?{ $d=0 })(?:\((?{$d++})|\)(?{$d--})(?(?{$d<0})(?!))|(?>[^()]*))*(?(?{$d!=0})(?!))$/'; $pattern_simple = '/^(?{$d=0})\(/'; $subject = '((I)(like(pie))!)'; echo "result: ".preg_match($pattern, $subject)."<br/>"; echo "result_simple: ".preg_match($pattern_simple, $subject)."<br/>"; ?> Expected result: ---------------- I'm not claiming that the regular expressions should produce a match, but they should compile and be evaluated, and thus return either a 0 or a 1. Actual result: -------------- Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (? or (?- at offset 2 in __FILE__ on line __LINE__