Bug #51630 [Fbk->Opn]: Can't call userland functions from __sleep()
Edit report at http://bugs.php.net/bug.php?id=51630&edit=1
ID: 51630
User updated by: peter dot dishman at telephoneticsvip dot co dot uk
Reported by: peter dot dishman at telephoneticsvip dot co dot uk
Summary: Can't call userland functions from __sleep()
-Status: Feedback
+Status: Open
Type: Bug
Package: Session related
Operating System: Windows XP SP2
PHP Version: 5.2.13
New Comment:
There don't seem to be any snapshots available at that windows url?
Previous Comments:
------------------------------------------------------------------------
[2010-04-30 01:26:53] felipe@php.net
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
I cannot reproduce it on 5.2.14-dev.
------------------------------------------------------------------------
[2010-04-22 10:49:03] peter dot dishman at telephoneticsvip dot co dot
uk
Description:
------------
Prior to v5.2.10 you could call userland functions in the magic method
__sleep(). Now in 5.2.10, .11, .12 and .13 I just get a fatal error
undefined
function when I try to do so.
I've tested this in 5.3.2 and it works correctly as it does in 5.2.9 and
before.
This is running on the standard 5.2.13 TS VS6 build and my session
configuration
is:
[Session]
session.save_handler = files
session.save_path = "c:/php/tmp"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = sID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 9000
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags =
"a=href,area=href,frame=src,input=src,form=,fieldset=,iframe=src"
Test script:
---------------
<?php
function inc ($foo) {
return ($foo + 1);
}
class foo {
function __construct() {
$this->bar = 0;
}
function __sleep() {
$this->bar = inc($this->bar);
return array('bar');
}
public $bar;
}
session_start();
if (!isset($_SESSION['foo'])) {
$_SESSION['foo'] = new foo();
}
$foo = $_SESSION['foo'];
echo "foo->bar = ".$foo->bar."<br>";
?>
Expected result:
----------------
As you refresh the page given by the script, you should just see the
number
increment each time with no errors generated.
Actual result:
--------------
In 5.2.13, after refreshing the page you get:
Fatal error: Call to undefined function inc() in C:\test\sleeptest.php
on line 12
This worked correctly in 5.2.9 and before, and also works in 5.3.2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51630&edit=1
Thread (4 messages)