Bug #74218 [Com]: ArrayIterator error message is confusing

From: Date: Tue, 07 Mar 2017 21:02:05 +0000
Subject: Bug #74218 [Com]: ArrayIterator error message is confusing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207729@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74218&edit=1 ID: 74218 Comment by: fernando at null-life dot com Reported by: fernando at null-life dot com Summary: ArrayIterator error message is confusing Status: Open Type: Bug Package: *General Issues Operating System: * PHP Version: 7.1.2 Block user comment: N Private report: N New Comment: Same message appears on: $arrayobject = new ArrayObject(0); Previous Comments: ------------------------------------------------------------------------ [2017-03-07 20:56:05] fernando at null-life dot com Description: ------------ The error message claims that an empty array will be used because an invalid argument was supplied, however the script will actually die because of a Fatal Error. Test script: --------------- <?php $x = new ArrayIterator('.'); echo "here"; Expected result: ---------------- php.exe x.php Fatal error: Uncaught InvalidArgumentException: Passed variable is not an array or object in x\x.php:3 Stack trace: #0 x\x.php(3): ArrayIterator->__construct('.') #1 {main} thrown in x\x.php on line 3 Actual result: -------------- php.exe x.php Fatal error: Uncaught InvalidArgumentException: Passed variable is not an array or object, using empty array instead in x\x.php:3 Stack trace: #0 x\x.php(3): ArrayIterator->__construct('.') #1 {main} thrown in x\x.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74218&edit=1

« previous php.bugs (#207729) next »