Bug #55366 [PATCH]: keys lost when using substr_replace replace an array
| From: | arpad@php.net | Date: | Fri, 05 Aug 2011 10:20:52 +0000 |
| Subject: | Bug #55366 [PATCH]: keys lost when using substr_replace replace an array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162437@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55366&edit=1
ID: 55366
Patch added by: arpad@php.net
Reported by: gorshang at gmail dot com
Summary: keys lost when using substr_replace replace an array
Status: Open
Type: Bug
Package: *General Issues
Operating System: win7
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2011-08-05 09:45:07] arpad@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