Edit report at https://bugs.php.net/bug.php?id=55366&edit=1
ID: 55366 Updated by: ar...@php.net Reported by: gorshang at gmail dot com Summary: keys lost when using substr_replace replace an array -Status: Open +Status: Closed Type: Bug Package: Strings related Operating System: win7 PHP Version: 5.3.6 -Assigned To: +Assigned To: arpad Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-08-29 20:38:42] ar...@php.net Automatic comment from SVN on behalf of arpad Revision: http://svn.php.net/viewvc/?view=revision&revision=315740 Log: Fixed bug #55366: keys lost when using substr_replace an array ------------------------------------------------------------------------ [2011-08-05 10:20:52] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-substr_replace-array-keys Revision: 1312539652 URL: https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312539652 ------------------------------------------------------------------------ [2011-08-05 09:45:07] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-substr_replace-array-keys Revision: 1312537507 URL: https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312537507 ------------------------------------------------------------------------ [2011-08-05 02:51:15] gorshang at gmail dot com keys lost when using substr_replace replace an array ------------------------------------------------------------------------ [2011-08-05 02:33:15] gorshang at gmail dot com Description: ------------ --- >From manual page: http://www.php.net/function.substr-replace%23Changelog --- My version is 5.3.5. But the keys lost when replace an array. I wan't write more, but I can't. Oh, my poor English. I'm Chinese. Tank you. Test script: --------------- <?php $arr = array('abc'=>'llsskdkk','def'=>'llsskjkkdd'); $newarr = substr_replace($arr, 'zzz', 0, -2); print_r($newarr); ?> Expected result: ---------------- Array ( [abc] => zzzkk [def] => zzzdd ) Actual result: -------------- Array ( [0] => zzzkk [1] => zzzdd ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55366&edit=1