Bug #64143 [NEW]: problem in array_slice function
| From: | ajaydixit91 at gmail dot com | Date: | Mon, 04 Feb 2013 16:43:10 +0000 |
| Subject: | Bug #64143 [NEW]: problem in array_slice function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-176429@lists.php.net to get a copy of this message | ||
From: ajaydixit91 at gmail dot com
Operating system: redhat enterprise linux 6
PHP version: 5.3.21
Package: Arrays related
Bug Type: Bug
Bug description:problem in array_slice function
Description:
------------
---
From manual page:
http://www.php.net/function.array-slice#refsect1-function.array-slice-description
---
I encountered this bug in array_slice() function. Here is what i
encountered.
I declared an array "my_array" with different offset value.
In my case its offset value is 1. So my_array[0] is not defined. Now when I
After that, i used the predefined function array_slice. In array_slice i
entered 1 and 3 as the offset value and required length value. Now as print
the sliced array, it should display:
shiva hanu bhrama
but what i am experiencing is :
vishnu shiva hanu.
It seems like that the array_slice function is not aware of the offset
value change in the array.
Test script:
---------------
<?php
$my_array = array( 1 => "vishnu" , "shiva" , "hanu" ,
"bhrama" );
print_r($my_array);
echo $my_array[0]; // this is coming undefined //
$slice = array_slice($my_array,1,3);
print_r($slice);
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=64143&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64143&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64143&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64143&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64143&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64143&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64143&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64143&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64143&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64143&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64143&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64143&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64143&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64143&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64143&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64143&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64143&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64143&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64143&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64143&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64143&r=mysqlcfg