ID: 41395 Updated by: [EMAIL PROTECTED] Reported By: daniel dot menard at bdsp dot tm dot fr -Status: Open +Status: Bogus Bug Type: Strings related Operating System: windows 2003 server PHP Version: 5.2.2 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2007-05-15 08:53:02] daniel dot menard at bdsp dot tm dot fr 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 this bug report at http://bugs.php.net/?id=41395&edit=1