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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC