#30791 [NEW]: overload and serialize produce unexpected behaviour
| From: | alan at akbkhome dot com | Date: | Mon, 15 Nov 2004 08:57:52 +0000 |
| Subject: | #30791 [NEW]: overload and serialize produce unexpected behaviour | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-69073@lists.php.net to get a copy of this message | ||
From: alan at akbkhome dot com
Operating system: na
PHP version: 5CVS-2004-11-15 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: overload and serialize produce unexpected behaviour
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 bug report at http://bugs.php.net/?id=30791&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30791&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30791&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30791&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30791&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30791&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30791&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30791&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30791&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30791&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30791&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30791&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30791&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30791&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30791&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30791&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30791&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30791&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30791&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30791&r=mysqlcfg