Bug #69172 [Csd]: array_slice behaviour BC in PHP7
Edit report at https://bugs.php.net/bug.php?id=69172&edit=1
ID: 69172
Updated by: yohgaki@php.net
Reported by: hdtfonseca at gmail dot com
Summary: array_slice behaviour BC in PHP7
Status: Closed
Type: Bug
Package: Arrays related
PHP Version: master-Git-2015-03-03 (Git)
Assigned To: reeze
Block user comment: N
Private report: N
New Comment:
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
)
Previous Comments:
------------------------------------------------------------------------
[2015-03-04 00:58:00] reeze@php.net
See bug #69166
------------------------------------------------------------------------
[2015-03-04 00:24:51] hdtfonseca at gmail dot com
Hi, I'm sorry, I couldn't find the commit in master, can you give me a hint?
------------------------------------------------------------------------
[2015-03-03 18:01:36] reeze@php.net
The fix for this bug has been committed.
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.
This has been fixed, please try lastest master.
------------------------------------------------------------------------
[2015-03-03 16:22:36] 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
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69172&edit=1
Thread (7 messages)