ID:               49867
 Comment by:       tomas dot plesek at gmail dot com
 Reported By:      nicolas dot lepage at yahoo dot fr
 Status:           Feedback
 Bug Type:         SPL related
 Operating System: *
 PHP Version:      5.3.0
 New Comment:

I can confirm that on stock version of 5.3.0, this bug does NOT occur.


Previous Comments:
------------------------------------------------------------------------

[2009-11-12 23:01:35] fel...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



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

[2009-11-12 20:16:21] daedalusvx at gmail dot com

I can confirm that this bug occurs on Ubuntu 9.10 with PHP 5.2.10, and
does NOT occur on PHP 5.3.0 on OS X through MacPorts.  Both have APC
installed and enabled.

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

[2009-11-10 03:41:25] hevayo at gmail dot com

I also got this Error when I update from php 5.2.6 to php 5.2.10. 

But I found out it only comes up if you have php-apc module enabled.
When you disable the apc module the error is not there

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

[2009-10-30 17:17:17] tomas dot plesek at gmail dot com

I can confirm this bug for PHP version 5.2.10 on Linux.

In my case, the custom session handler code is a class, but the same
behavior occurs. When a class is instantiated inside write method and
that class should be loaded by an autoloader function, fatal error with
already mentioned message is issued (like no autoloader methods are
registered) and upon call to spl_autoload_functions(), Apache
segfaults.
I used PHP 5.2.6 prior to upgrade and the code worked fine on that
version.

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

[2009-10-13 16:41:59] nicolas dot lepage at yahoo dot fr

Description:
------------
When trying to instantiate a class that is not defined within the write
function that has been registered as a custom session save handler, the
following problems occur :
_ functions that have been registered by spl_autoload_register are not
called
_ a fatal error is generated by spl_autoload()

In the reproduce code, the normal behavior would be to generate a fatal
error 'class not found'.

This problem occurs only in the write function and not in the others.

Additionnaly, when I replace the instantiation code by a call to
spl_autoload_functions(), the apache server crashes.

It could be related to bug #37111.

Reproduce code:
---------------
<?php
function test_autoload($className) {
}

function open($save_path, $session_name) {
        return true;
}

function close() {
        return true;
}

function read($id) {
        return '';
}

function write($id, $sess_data) {
        new NotLoadedClass();
        return true;
}

function destroy($id) {
        return true;
}

function gc($maxlifetime) {
        return true;
}

spl_autoload_register('test_autoload');

session_set_save_handler("open", "close", "read", "write", "destroy",
"gc");

session_start();
?>

Expected result:
----------------
Fatal error: Class 'NotLoadedClass' not found in
F:\xampp\htdocs\test\test.php on line 18

Actual result:
--------------
Fatal error: spl_autoload() [<a
href='function.spl-autoload'>function.spl-autoload</a>]: Class
NotLoadedClass could not be loaded in F:\xampp\htdocs\test\test.php on
line 18


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


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

Reply via email to