From: italopaesano at gmail dot com
Operating system: linux
PHP version: 5.3.21
Package: *General Issues
Bug Type: Bug
Bug description:function array_splice() wrong result
Description:
------------
function array_splice()
return wrong result when splice multidimensional array.
i hope that the attached script is clear.
sorry for my english.
Test script:
---------------
$a = array();
$a[] = array(
'start' => array('day' => '1','month '=> '2'),
'end' => array('day'=> '3','month'=> '2'));
$a[] = array(
'start' => array('day' => '1','month '=> '3'),
'end' => array('day'=> '3','month'=> '3'));
$strip = array(
'start' => array('day' => '11','month '=> '1'),
'end' => array('day'=> '14','month'=> '1'));
array_splice($a, 0, 1, $strip);
$temp = print_r($a,TRUE);
$temp = str_replace("\n", '<br>', $temp);
echo str_replace(" ", " ",$temp);
Expected result:
----------------
Array
(
[0] => Array
(
[start] => Array
(
[day] => 11
[month ] => 1
)
[end] => Array
(
[day] => 14
[month] => 1
)
)
[1] => Array
(
[start] => Array
(
[day] => 1
[month ] => 3
)
[end] => Array
(
[day] => 3
[month] => 3
)
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[day] => 11
[month ] => 1
)
[1] => Array
(
[day] => 14
[month] => 1
)
[2] => Array
(
[start] => Array
(
[day] => 1
[month ] => 3
)
[end] => Array
(
[day] => 3
[month] => 3
)
)
)
--
Edit bug report at https://bugs.php.net/bug.php?id=64192&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64192&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64192&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64192&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64192&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64192&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64192&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64192&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64192&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64192&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64192&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64192&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64192&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64192&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64192&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64192&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64192&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64192&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64192&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64192&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64192&r=mysqlcfg