#30791 [Opn->Fbk]: overload and serialize produce unexpected behaviour

From: Date: Wed, 12 Jan 2005 23:02:04 +0000
Subject: #30791 [Opn->Fbk]: overload and serialize produce unexpected behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71993@lists.php.net to get a copy of this message
ID: 30791 Updated by: tony2001@php.net Reported By: alan at akbkhome dot com -Status: Open +Status: Feedback Bug Type: Zend Engine 2 problem Operating System: na PHP Version: 5CVS-2004-11-15 (dev) New Comment: >If an object is overloaded (with __call()), then >serializ'ing the object will fail unless __sleep() is defined. .. or unless __call() returns Array of instance names. I'd say there is no bug, 'cos your overloaded __sleep() method indeed returns wrong data. Previous Comments: ------------------------------------------------------------------------ [2004-11-15 09:57:51] alan at akbkhome dot com Description: ------------ If an object is overloaded (with __call()), then serializ'ing the object will fail unless __sleep() is defined. It would be far clearer to either a) - force __sleep to defined on overloaded objects (E_WARN?) b) - dont call __call() with the __sleep() request. Reproduce code: --------------- class a { public $a = 4; function __call($a,$b) { return "unknown method"; } } $b = new a; echo serialize($b); Expected result: ---------------- Warning: __sleep is not defined on an overloaded object with __call() Actual result: -------------- Warning about unexpected return value to __sleep() and an empty string output from serialize() ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30791&edit=1

« previous php.bugs (#71993) next »