From: janne dot raiskila at gmail dot com Operating system: Windows Vista SP2 32-bit PHP version: 5.3SVN-2009-09-06 (snap) PHP Bug Type: Reflection related Bug description: preg_replace 'subject' parameter listed as optional
Description: ------------ According to reflection the third parameter to preg_replace (subject) is optional. Calling preg_replace without a third argument, however, issues a warning. This bug is similar to #45909 (filed for PHP 5.2.6 in 2008, closed), but the output has changed since (when most of the reflection bugs were fixed for 5.3.0). Reproduce code: --------------- 1) php --rf preg_replace 2) $fn = new ReflectionFunction("preg_replace"); printf("Total: %d\nRequired: %d\n", $fn->getNumberOfParameters(), $fn->getNumberOfRequiredParameters() ); Expected result: ---------------- 1) >php --rf preg_replace Function [ <internal:pcre> function preg_replace ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] Parameter #2 [ <required> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } } 2) Total: 5 Required: 3 Actual result: -------------- 1) >php --rf preg_replace Function [ <internal:pcre> function preg_replace ] { - Parameters [5] { Parameter #0 [ <required> $regex ] Parameter #1 [ <required> $replace ] Parameter #2 [ <optional> $subject ] Parameter #3 [ <optional> $limit ] Parameter #4 [ <optional> &$count ] } } 2) Total: 5 Required: 2 -- Edit bug report at http://bugs.php.net/?id=49483&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49483&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49483&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49483&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49483&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49483&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49483&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49483&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49483&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49483&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49483&r=support Expected behavior: http://bugs.php.net/fix.php?id=49483&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49483&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49483&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49483&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49483&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49483&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49483&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49483&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49483&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49483&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49483&r=mysqlcfg