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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Wed Jun 12 05:01:35 2024 UTC