php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71028 Undefined index with ArrayIterator
Submitted: 2015-12-04 11:54 UTC Modified: -
From: vincent dot guth at gmail dot com Assigned:
Status: Closed Package: Output Control
PHP Version: 7.0.0 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vincent dot guth at gmail dot com
New email:
PHP Version: OS:

 

 [2015-12-04 11:54 UTC] vincent dot guth at gmail dot com
Description:
------------
Hello

I have a PHP warning with ArrayIterator when used with references.
Thank you for looking at this.


My test scripts works as expected if you replace 'cast($b)' by '$b = (int)$b'

Test script:
---------------
<?php
function cast(&$a) {
	$a = (int)$a;
}

$a = new ArrayIterator;
$a[-1] = 123;

$b = "-1";
cast($b);

echo $a[$b];
?>

Expected result:
----------------
123

Actual result:
--------------
PHP Warning:  Illegal offset type in /tmp/test.php on line 12



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-04 14:45 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7ac24aa661b9bc9983bb92a734e2c9993db147c5
Log: Fixed bug #71028 (Undefined index with ArrayIterator)
 [2015-12-04 14:45 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:35 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7ac24aa661b9bc9983bb92a734e2c9993db147c5
Log: Fixed bug #71028 (Undefined index with ArrayIterator)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 09:01:28 2024 UTC