From: daniel dot menard at bdsp dot tm dot fr Operating system: windows 2003 server PHP version: 5.2.2 PHP Bug Type: Strings related Bug description: behaviour of substr_replace changed in php 5.2.2
Description: ------------ The behaviour of substr_replace seems to have changed in php 5.2.2 when the length parameter is specified and is greater than the actual length of the string to modify. With php < 5.2.2, the string is extended, with php 5.2.2 substr_replace returns false. I don't know if this is an intended change or not, but this change is not documented in the function description. Just in case it matters: I'm using php 5.2.2 in cli mode with apache/2.2.4 on a windows 2003 server. Note: perhaps it is related to http://bugs.php.net/bug.php?id=40754 Thanks ! Reproduce code: --------------- <?php echo PHP_VERSION, ' : '; var_dump(substr_replace('012', 'ABCD', 0, 4)); ?> Expected result: ---------------- either the same result as in in previous php versions or a note in the documentation stating that the behaviour has changed. Actual result: -------------- with PHP 5.2.2, I get: 5.2.2 : bool(false) With older versions of php I get: 5.2.1 : string(4) "ABCD" 5.2.0 : string(4) "ABCD" 5.1.2 : string(4) "ABCD" 5.1.1 : string(4) "ABCD" -- Edit bug report at http://bugs.php.net/?id=41395&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41395&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41395&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41395&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41395&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41395&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41395&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41395&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41395&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41395&r=support Expected behavior: http://bugs.php.net/fix.php?id=41395&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41395&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41395&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41395&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41395&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41395&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41395&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41395&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41395&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41395&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41395&r=mysqlcfg