Bug #71028 [Opn->Csd]: Undefined index with ArrayIterator

From: Date: Fri, 04 Dec 2015 14:45:51 +0000
Subject: Bug #71028 [Opn->Csd]: Undefined index with ArrayIterator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197590@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71028&edit=1

 ID:                 71028
 Updated by:         laruence@php.net
 Reported by:        vincent dot guth at gmail dot com
 Summary:            Undefined index with ArrayIterator
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Output Control
 PHP Version:        7.0.0
 Block user comment: N
 Private report:     N

 New Comment:

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)


Previous Comments:
------------------------------------------------------------------------
[2015-12-04 11:54:08] 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




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71028&edit=1


Thread (2 messages)

« previous php.bugs (#197590) next »