#49867 [NEW]: spl_autoload crashes when called in write function of custom sessionSaveHandler
| From: | nicolas dot lepage at yahoo dot fr | Date: | Tue, 13 Oct 2009 16:41:59 +0000 |
| Subject: | #49867 [NEW]: spl_autoload crashes when called in write function of custom sessionSaveHandler | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143529@lists.php.net to get a copy of this message | ||
From: nicolas dot lepage at yahoo dot fr
Operating system: Windows, Unix
PHP version: 5.3.0
PHP Bug Type: SPL related
Bug description: spl_autoload crashes when called in write function of custom sessionSaveHandler
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 bug report at http://bugs.php.net/?id=49867&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49867&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49867&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49867&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49867&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49867&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49867&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49867&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49867&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49867&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49867&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49867&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49867&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49867&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49867&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49867&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49867&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49867&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49867&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49867&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49867&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49867&r=mysqlcfg