ID:               32749
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cr at speedofmind dot com
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Linux 2.4.26
 PHP Version:      5.0.3
 New Comment:

<?php 
test;
?>


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

[2005-04-18 20:41:23] cr at speedofmind dot com

Seems your Bug system chokes on PHP-tags in the submitted code. Here's
the code without surrounding PHP-tags:

class Fruit {
    var $kind;
    var $foo = 'not';
    function Fruit($kind) { $this->kind = $kind; }
    function __wakeup() { $this->foo = 'bar1'; }
    function __sleep() { $this->foo = 'bar2'; } // BREAKS
shm_put_var/shm_get_var                                         
}

$var = new Fruit('apple');
$key = 1;

$shmId = shm_attach(24187);
shm_put_var($shmId, $key, $var);
$out = shm_get_var($shmId, $key);  

var_dump($out);

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

[2005-04-18 20:39:26] cr at speedofmind dot com

Reproducable code again:

<?php

class Fruit {
    var $kind;
    var $foo = 'not';
    function Fruit($kind) { $this->kind = $kind; }
    function __wakeup() { $this->foo = 'bar1'; }
    function __sleep() { $this->foo = 'bar2'; } // BREAKS
shm_put_var/shm_get_var                                         
}

$var = new Fruit('apple');
$key = 1;

$shmId = shm_attach(24187);
shm_put_var($shmId, $key, $var);
$out = shm_get_var($shmId, $key);  

var_dump($out);

?>

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

[2005-04-18 20:38:03] cr at speedofmind dot com

Description:
------------
When defining a __sleep funtion in a class, it is not possible to
successfully save and retrieve objects of this class using shm_put_var
and shm_get_var. shm_get_var simple returns NULL.

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

class Fruit {
    var $kind;
    var $foo = 'not';
    function Fruit($kind) { $this->kind = $kind; }
    function __wakeup() { $this->foo = 'bar1'; }
    function __sleep() { $this->foo = 'bar2'; } // BREAKS
shm_put_var/shm_get_var                                         
}

$var = new Fruit('apple');
$key = 1;

$shmId = shm_attach(24187);
shm_put_var($shmId, $key, $var);
$out = shm_get_var($shmId, $key);  

var_dump($out);

?>

Expected result:
----------------
Expected output:

object(Fruit)#2 (2) {
  ["kind"]=>
  string(5) "apple"
  ["foo"]=>
  string(4) "bar1"
}

Actual result:
--------------
Actual output:

NULL


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


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

Reply via email to