Bug #53141 [Opn]: autoload misbehaves if called from closing session

From: Date: Mon, 01 Nov 2010 18:17:18 +0000
Subject: Bug #53141 [Opn]: autoload misbehaves if called from closing session
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155681@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53141&edit=1

 ID:                 53141
 User updated by:    ladislav at marek dot su
 Reported by:        ladislav at marek dot su
 Summary:            autoload misbehaves if called from closing session
 Status:             Open
 Type:               Bug
 Package:            SPL related
 Operating System:   GNU Linux
 PHP Version:        5.3SVN-2010-10-23 (SVN)
 Block user comment: N

 New Comment:

It looks like that --with-mysql=mysqlnd configuration causes different
order of 
extensions, so SPL extension is destroyed before the session is.

Adding session dependency to SPL fixes this bug (I'm not sure if is it
correct 
way).


Previous Comments:
------------------------------------------------------------------------
[2010-10-24 13:51:55] ladislav at marek dot su

I can reproduce it with '--with-mysql=mysqlnd' configuration.

------------------------------------------------------------------------
[2010-10-23 17:38:12] ladislav at marek dot su

I updated PHP from the SVN (rev 304664). With PHP compiled only with
"--with-config-file-path=/etc/php" script runs as 
expected, but fails with configure options:

--with-config-file-path=/etc/php --with-openssl --with-kerberos
--with-zlib --enable-bcmath --with-bz2 --with-curl --with-
curlwrappers --enable-dba --enable-ftp --with-gd
--with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-zlib-
dir=/usr/include --with-xpm-dir=/usr/include
--with-freetype-dir=/usr/lib --enable-gd-native-ttf --with-gettext
--with-mhash 
--with-imap --with-imap-ssl --with-ldap --enable-mbstring --with-mcrypt
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-
pdo-mysql=mysqlnd --with-pdo-pgsql --with-pgsql --enable-shmop
--enable-soap --enable-sockets --enable-sqlite-utf8 --enable-
sysvmsg --with-tidy --with-xmlrpc --with-xsl --enable-zip --enable-intl
--enable-fpm

------------------------------------------------------------------------
[2010-10-23 16:55:02] felipe@php.net

I got the expected result when testing on the 5.3 SVN version. Are you
actually using the lastest SVN version?

------------------------------------------------------------------------
[2010-10-23 10:36:09] ladislav at marek dot su

Description:
------------
SPL autoload triggers fatal error if is called from currently closing
session. 
With __autoload function scripts works fine.

Test script:
---------------
spl_autoload_register(function ($class) {
    var_dump("Loading $class");
    eval('class Bar {}');
});

class Foo
{
    function __sleep()
    {
        new Bar;
        return array();
    }
}

session_start();
$_SESSION['foo'] = new Foo;

Expected result:
----------------
string(11) "Loading Bar"

Actual result:
--------------
Fatal error: spl_autoload(): Class Bar could not be loaded in 
/var/www/hosts/tests.l/index.php on line 14


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53141&edit=1


Thread (10 messages)

« previous php.bugs (#155681) next »