php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74218 ArrayIterator error message is confusing
Submitted: 2017-03-07 20:56 UTC Modified: -
From: fernando at null-life dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.1.2 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fernando at null-life dot com
New email:
PHP Version: OS:

 

 [2017-03-07 20:56 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-07 21:02 UTC] fernando at null-life dot com
Same message appears on:

$arrayobject = new ArrayObject(0);
 [2017-03-10 07:18 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c398198c0a8e58bc37a441bcfbfe1eb0e8058d9f
Log: Fixed bug #74218 (ArrayIterator error message is confusing)
 [2017-03-10 07:18 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 01 01:01:28 2024 UTC