|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #24670 defining __call requires __sleep for serialize/session
Submitted: 2003-07-16 01:07 UTC Modified: 2005-05-30 10:04 UTC
Avg. Score:4.3 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:1 (16.7%)
From: tater at potatoe dot com Assigned: dmitry (profile)
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: OS X 10.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tater at potatoe dot com
New email:
PHP Version: OS:


 [2003-07-16 01:07 UTC] tater at potatoe dot com
If you create a __call() method for a class, and then try to serialize it yourself, or store an object of that class in $_SESSION, you need to either explicitly define a __sleep() method as well, or make sure that __call() will respond appropriately. Otherwise serialize() will complain. It seems unlikely that this is a bug, though I suppose it might be a feature request. So it should just be spelled out in the documentation for __call() when that gets written.

Reproduce code:
class foo { function __call() { return; } }
$a = new foo;

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-17 23:28 UTC] magicking89 at hotmail dot com
I have the same problem with PHP5 RC2 on Mac Os X 10.2 It's a real problem because I must to close socket with __sleep but it doesn't work correctly...
 [2005-04-01 13:52 UTC] maka3d at yahoo dot com dot br
Does there is a workaround to this?
I did some tests but didn't work?
I thought it would be fixed until 5.0.4
 [2005-04-14 10:23 UTC]
It seems that classes with __call or __sleep (!) methods simply can't be serialized (serialize() returns "N;" for them). If you can reproduce it, please change the Category of this bug to Zend Engine 2 problem.

And fill in your PHP Version, please.
 [2005-04-22 01:00 UTC] phpdoc at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-05-30 10:02 UTC]
this seems to be a dupe of #30791
 [2005-05-30 10:04 UTC]
dupes are marked as bogus, and #30791 seems to be more detailed.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 14:03:38 2021 UTC