|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-09-09 16:39 UTC] cmb@php.net
[2021-09-09 17:04 UTC] cmb@php.net
-Summary: Different behavior calling end() on an ArrayObject
between 7.3.26 and 7.4.23
+Summary: ArrayObject no longer supports end() etc.
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
[2021-09-09 17:04 UTC] cmb@php.net
[2023-04-25 08:19 UTC] preetishaub at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
Description: ------------ We've seen a variation in the behavior of end() when calling it on an ArrayObject between 7.3.26 and 7.4.23. The test script returns the final element in the ArrayObject on PHP 7.3.26, but false on PHP 7.4.23. I'm unclear as to why this behavior has changed as there are no documented changes to end() or ArrayObject behavior that I see in the PHP 7.3 to 7.4 migration guide. Test script: --------------- <?php $arrayObject = new ArrayObject(); $arrayObject->append(new stdClass()); $arrayObject->append(new stdClass()); var_dump(end($arrayObject)); Expected result: ---------------- I expect to have the final ArrayObject element returned by the call to end() on both PHP 7.3.x and 7.4.x. Actual result: -------------- On PHP 7.3.26, the final object within the ArrayObject is returned. On PHP 7.4.23, false is returned. 7.3.26 ------ $ php -v PHP 7.3.26 (cli) (built: Mar 29 2021 18:09:35) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.26, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.26, Copyright (c) 1999-2018, by Zend Technologies with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans $ php ./test.php test.php:6: class stdClass#3 (0) { } 7.4.23 ------ $ php -v PHP 7.4.23 (cli) (built: Aug 31 2021 16:08:26) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.23, Copyright (c), by Zend Technologies with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans $ php ./test.php test.php:6: bool(false)