Bug #69172 [Opn->Csd]: array_slice behaviour BC in PHP7

From: Date: Tue, 03 Mar 2015 18:01:36 +0000
Subject: Bug #69172 [Opn->Csd]: array_slice behaviour BC in PHP7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191098@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69172&edit=1

 ID:                 69172
 Updated by:         reeze@php.net
 Reported by:        hdtfonseca at gmail dot com
 Summary:            array_slice behaviour BC in PHP7
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Arrays related
 PHP Version:        master-Git-2015-03-03 (Git)
-Assigned To:        
+Assigned To:        reeze
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#191098) next »