|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49537 ArrayAccess offsetSet give null argument values when using $append[]
Submitted: 2009-09-12 22:07 UTC Modified: 2009-09-12 22:17 UTC
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kevinpeno at gmail dot com Assigned:
Status: Not a bug Package: SPL related
PHP Version: 5.3.0 OS: WIN7
Private report: No CVE-ID: None
 [2009-09-12 22:07 UTC] kevinpeno at gmail dot com
Whenever you use the $append[] method, offsetGet in object implementing ArrayAccess.

Reproduce code:
class MyArrayObject extends ArrayObject
	function offsetSet( $k, $v )
		//Will Print OffsetSet: \n NULL \n NULL - 
		var_dump( 'offsetSet:', $k, $value );


$test = new MyArrayObject();
$test[] = 'test';

Expected result:
Arguments in offsetGet should return the new offset key and the value properly.

Actual result:
$k and $v in the example above var_dump to NULL


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-12 22:09 UTC] kevinpeno at gmail dot com
I messed up my description. This is what it should ahve been:

Whenever you use the $append[] method, offsetSet arguments in object implementing ArrayAccess will receive only NULL values.
 [2009-09-12 22:17 UTC] kevinpeno at gmail dot com
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 16:01:23 2020 UTC