Bug #52604 [Bgs]: Serialization of objects with __sleep() and fatal error
Edit report at http://bugs.php.net/bug.php?id=52604&edit=1 ID: 52604 User updated by:zerspam at mail dot ru Reported by:zerspam at mail dot ru Summary:Serialization of objects with __sleep() and fatal error Status: Bogus Type: Bug Package:Session related Operating System: irrelevant PHP Version:Irrelevant Block user comment: N New Comment: Uhm, in any case: wherther it is a error or not - I expected php does not broke my data. And I cannot get how your sample related to mine. With my code you can see that php stores the data it should not store. And it is a error. Previous Comments: [2010-10-12 14:24:52] tony2...@php.net >However if your class implements Serializable everything works as >expected when there is a fatal error. Not true. See this example: - set_error_handler('my_error_handler'); session_start(); $a->b(); class myclass implements Serializable { private $a= 1; private $b = 2; public function serialize() { var_dump("serialize"); return serialize(array('a')); } public function unserialize($data) { var_dump("unserialize"); return unserialize($data); } } function my_error_handler($code, $error, $file = NULL, $line = NULL) { throw new ErrorException($error, $code, 0, $file, $line); } $obj = new myclass(); $_SESSION['obj'] = $obj; - Whether your class implements Serializable or not, serializers are called on _request shutdown_ which never happens in case of fatal error, because fatal error means BOOM!, exit. And to be honest, I don't see anything wrong here. Your script FAILED with a fatal error, did you expect PHP to ignore it an go on running? [2010-09-14 04:43:08] isaiah dot derosewilson at kohanaphp dot com I also have this same problem. I've tested both php 5.2.12 and 5.3.3 and neither of them correctly serialize the object when there is a fatal error - the whole object gets serialized when there is a fatal error instead of just the properties in __sleep(). However if your class implements Serializable everything works as expected when there is a fatal error. ---------------- [2010-09-05 13:32:43] zerspam at mail dot ru Well, 3 weeks left and even no comments from dev team? ---------------- [2010-08-14 09:40:26] zerspam at mail dot ru Description: Seems like __sleep() does not being invoked when fatal error was risen. Test script: --- set_error_handler('my_error_handler'); session_start(); $obj = new myclass(); $_SESSION['obj'] = $obj; $a->b(); class myclass { private $a = 1; private $b = 2; public function __sleep() { return array('a'); } } function my_error_handler($code, $error, $file = NULL, $line = NULL) { throw new ErrorException($error, $code, 0, $file, $line); } Expected result: Object with only 'a' property in session file Actual result: -- Object with 'a' and 'b' properties in session file -- Edit this bug report at http://bugs.php.net/bug.php?id=52604&edit=1
Bug #52604 [Com]: Serialization of objects with __sleep() and fatal error
Edit report at http://bugs.php.net/bug.php?id=52604&edit=1 ID: 52604 Comment by: zerspam at mail dot ru Reported by:zerspam at mail dot ru Summary:Serialization of objects with __sleep() and fatal error Status: Open Type: Bug Package:Session related Operating System: irrelevant PHP Version:Irrelevant Block user comment: N New Comment: Well, 3 weeks left and even no comments from dev team? Previous Comments: [2010-08-14 09:40:26] zerspam at mail dot ru Description: Seems like __sleep() does not being invoked when fatal error was risen. Test script: --- set_error_handler('my_error_handler'); session_start(); $obj = new myclass(); $_SESSION['obj'] = $obj; $a->b(); class myclass { private $a = 1; private $b = 2; public function __sleep() { return array('a'); } } function my_error_handler($code, $error, $file = NULL, $line = NULL) { throw new ErrorException($error, $code, 0, $file, $line); } Expected result: Object with only 'a' property in session file Actual result: -- Object with 'a' and 'b' properties in session file -- Edit this bug report at http://bugs.php.net/bug.php?id=52604&edit=1
[PHP-BUG] Bug #52604 [NEW]: Serialization of objects with __sleep() and fatal error
From: Operating system: irrelevant PHP version: Irrelevant Package: Session related Bug Type: Bug Bug description:Serialization of objects with __sleep() and fatal error Description: Seems like __sleep() does not being invoked when fatal error was risen. Test script: --- set_error_handler('my_error_handler'); session_start(); $obj = new myclass(); $_SESSION['obj'] = $obj; $a->b(); class myclass { private $a = 1; private $b = 2; public function __sleep() { return array('a'); } } function my_error_handler($code, $error, $file = NULL, $line = NULL) { throw new ErrorException($error, $code, 0, $file, $line); } Expected result: Object with only 'a' property in session file Actual result: -- Object with 'a' and 'b' properties in session file -- Edit bug report at http://bugs.php.net/bug.php?id=52604&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52604&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52604&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52604&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52604&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52604&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52604&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52604&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52604&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52604&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52604&r=support Expected behavior: http://bugs.php.net/fix.php?id=52604&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52604&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52604&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52604&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52604&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=52604&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52604&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52604&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52604&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52604&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52604&r=mysqlcfg
#46586 [NEW]: Lower case method name casting for static __call(), not for dynamic
From: zerspam at mail dot ru Operating system: PHP version: 5.2.6 PHP Bug Type: Scripting Engine problem Bug description: Lower case method name casting for static __call(), not for dynamic Description: I think the method name shouldn't cast to lower case if static calling used. Reproduce code: --- class a { function __call($name, $p) { echo $name . ' '; } function foo() { $this->BaR(); self::BaR(); } } $a = new a(); $a->BaZ(); $a->foo(); Expected result: BaZ BaR BaR Actual result: -- BaZ BaR bar -- Edit bug report at http://bugs.php.net/?id=46586&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46586&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46586&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46586&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46586&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46586&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46586&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46586&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46586&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46586&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46586&r=support Expected behavior: http://bugs.php.net/fix.php?id=46586&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46586&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46586&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46586&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46586&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=46586&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46586&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46586&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46586&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46586&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46586&r=mysqlcfg