From: csaba at alum dot mit dot edu
Operating system: Win 2K
PHP version: 4.3.0
PHP Bug Type: PCRE related
Bug description: PREG_OFFSET_CAPTURE produces error with preg_match_all
The following code gives me an error message of:
Wrong value for parameter 4 in call to preg_match_all() ...
if I replace the PREG_OFFSET_CAPTURE with either
PREG_OFFSET_CAPTURE | PREG_SET_ORDER
or PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER
then it works as advertised.
This contradicts the documentation statement:
If no order flag is given, PREG_PATTERN_ORDER is assumed
$page = "<html><head></head><body><form>" .
"<input onClick='alert(\"Hi Mom\")' " .
"value='Click me'>" .
"<input onClick='alert(\"Hi Dad\")' " .
"value=\"Dad's button\">" .
"</form></body></html>";
$regexp = "/<input[^>]*(value=[^>]*)>/";
if (!preg_match_all($regexp, $page, $mtch,
PREG_OFFSET_CAPTURE))
print "<br>Could not match";
else print "<br>Found matches";
This is on my PHP 4.3.0 / Apache 2.0.43 / Win 2K Pro system
Csaba Gabor from New York
--
Edit bug report at http://bugs.php.net/?id=22366&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22366&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22366&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22366&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22366&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22366&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22366&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22366&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22366&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22366&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22366&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22366&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22366&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22366&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22366&r=gnused