php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56607 segfault implementing SPL and Class type checking
Submitted: 2005-10-21 14:45 UTC Modified: 2006-02-24 10:47 UTC
From: jonathan dot semczyk at telecomlille dot net Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5_1 CVS-2005-10-21 (dev) OS: Ubuntu Breezy
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: jonathan dot semczyk at telecomlille dot net
New email:
PHP Version: OS:

 

 [2005-10-21 14:45 UTC] jonathan dot semczyk at telecomlille dot net
Description:
------------
I have a segfault with a very specific code. I have an index.php that loads 2 class files, it also create a new class with a type checking in the constructor.

This is the only way I found to reproduce the segfault.

If I put everything in the same file it works.
If I remove the type checking it works.
If I remove the SPL implements it works.

So, it looks like it is a combination of all this.


Reproduce code:
---------------
index.php
--------------------

require_once 'objectlist.php';
require_once 'pouet.php';

class Test
{
	function __construct(Pouet $p)
	{
		$this->jon = $p;
	}
}

$p = new Pouet();
$t = new Test($p);
var_dump($t);


objectlist.php
--------------------

class ObjectList implements ArrayAccess
{
	protected $data;
	function __construct()
	{
		$this->data = array();
	}
	function key() { }
	function offsetExists($offset) { }
	function offsetGet($offset) { }
	function offsetSet($offset, $value) { }
	function offsetUnset($offset) { }
}


pouet.php
--------------------

class Pouet extends ObjectList
{
	function __construct()
	{
		parent::__construct();
		$this->t = time();
	}
}



Expected result:
----------------
object(Test)#2 (1) {
  ["jon"]=>
  object(Pouet)#1 (2) {
    ["data:protected"]=>
    array(0) {
    }
    ["t"]=>
    int(1129920211)
  }
}

Actual result:
--------------
[notice] child pid 13812 exit signal Segmentation fault (11)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-25 20:38 UTC] soporte at onfocus dot cl
Not reproducible here

using php 5.0.3, APC CVS (24/10/2005) ,SUSE linux amd64 , versi?n 3.3.5 20050117 apache2-prefork-2.0.53.
 [2006-02-24 10:47 UTC] rasmus@php.net
This should be fixed in CVS now.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Sep 17 06:00:01 2025 UTC