From:             cr at speedofmind dot com
Operating system: Linux 2.4.26
PHP version:      5.0.3
PHP Bug Type:     Zend Engine 2 problem
Bug description:  shm_put_var/shm_get_var does not work on objects with __sleep 
defined

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 bug report at http://bugs.php.net/?id=32749&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32749&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32749&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32749&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32749&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32749&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32749&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32749&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32749&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32749&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32749&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32749&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32749&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32749&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32749&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32749&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32749&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32749&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32749&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32749&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32749&r=mysqlcfg

Reply via email to