ID:               43319
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Reproducible crash
 Operating System: Linux, Windows
 PHP Version:      5.2.5
 New Comment:

I don't know if this is the more apropriated solution for this
problem.
When you try without the use of interface, you have the same recursion,
but no crash.


Previous Comments:
------------------------------------------------------------------------

[2007-11-18 04:28:43] crrodriguez+php at suse dot de

This causes infinite recursion,hence a crash..  I expect a very clear:

zend_error(E_ERROR, "Nesting level too deep - recursive dependency?");

------------------------------------------------------------------------

[2007-11-17 15:26:04] [EMAIL PROTECTED]

Description:
------------
Apache crashes and CLI segfault when serializing objects which have
circular references and implements the Serializable interface.
Whitout the interface, the serialization and deserialization occurs
without any problem.

Reproduce code:
---------------
<?php

class A implements Serializable {

  private $b;

  public function setB($b) {
    $this->b = $b;
  }
  
  public function serialize() {
    return serialize($this->b);
  }
  
  public function unserialize($s) {
    $this->b = unserialize($s);
  }

}

class B {

  private $a;

  public function __construct($a) {
    $a->setB($this);
    $this->a = $a;
  }
}


$a = new A();
$b = new B($a);

var_dump(serialize($b));
?>


Expected result:
----------------
The string of the serialized object.

Actual result:
--------------
Apache crash or cli segfault.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43319&edit=1

Reply via email to