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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kevinpeno at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 16:01:37 2025 UTC