php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49449 Segmentation fault with ArrayObject::offsetSet()
Submitted: 2009-09-03 10:33 UTC Modified: 2009-09-03 11:12 UTC
From: arnold at adaniels dot nl Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.3.0 OS: Linux / Ubuntu 9.04
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: arnold at adaniels dot nl
New email:
PHP Version: OS:

 

 [2009-09-03 10:33 UTC] arnold at adaniels dot nl
Description:
------------
Using array access on $this in ArrayObject::offsetSet() causes a segmentation fault.

(Calling parent::offsetSet() instead, works fine)

Reproduce code:
---------------
class AOTest extends ArrayObject
{
	public function offsetSet($index, $newval)
	{
		$this[$index] = (int)$newval;
	}	
}

$a = new AOTest();
$a['test'] = "10 doves";
var_dump((array)$a);

Expected result:
----------------
array(1) {
  ["test"]=>
  int(10)
}


Actual result:
--------------
Segmentation fault


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-03 11:12 UTC] mike@php.net
You generate an infinite recursion.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 11:00:03 2025 UTC