php.net |  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
Votes:1
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
15 + 19 = ?
Subscribe to this entry?

 
 [2009-09-12 22:07 UTC] kevinpeno at gmail dot com
Description:
------------
Whenever you use the $append[] method, offsetGet in object implementing ArrayAccess.

Reproduce code:
---------------
<?php
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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
Sorry...
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 16:01:42 2019 UTC