|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-03-03 16:22 UTC] hdtfonseca at gmail dot com
Description:
------------
The array_slice functions seems to being behaving differently in master (PHP7).
The attached test script will output differently in PHP < 7
Test script:
---------------
$stack[] = 'wew';
$stack[] = 'wew';
$stack[] = 'wew';
$stack[] = 'wew';
$stack = array_slice($stack, 0, - 2);
$stack[] = 'wew';
print_r($stack);
Expected result:
----------------
Array
(
[0] => wew
[1] => wew
[2] => wew
)
Actual result:
--------------
Array
(
[0] => wew
[1] => wew
[3] => wew
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 21 23:00:01 2025 UTC |
It seems it's fixed. I don't know which commit does, though. [yohgaki@dev php-src]$ ./php-bin <?php $stack[] = 'wew'; $stack[] = 'wew'; $stack[] = 'wew'; $stack[] = 'wew'; $stack = array_slice($stack, 0, - 2); $stack[] = 'wew'; print_r($stack); Array ( [0] => wew [1] => wew [2] => wew )