ID: 37578 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Class/Object related Operating System: Gentoo Linux PHP Version: 5.1.4 New Comment:
Ok. But I don't understand why it shouldn't work in the future. Why are objects in the session unserialized before the script has been parsed? If I set unserialize_callback_func to a value in a htaccess then PHP knows about it and should call it. Previous Comments: ------------------------------------------------------------------------ [2006-05-24 13:43:01] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php As you use session.auto_start and no script has been executed when the session starts PHP knows nothing about that callback. ------------------------------------------------------------------------ [2006-05-24 13:32:45] [EMAIL PROTECTED] Description: ------------ Using unserialize_callback_func in a htaccess has no effect. The required classes do not get loaded. Reproduce code: --------------- ** .htacces php_value unserialize_callback_func "myCallBack" php_flag session.auto_start On ** index.php <?php function __autoload($class) { require_once './' . $class . '.php'; } function myCallBack($class) { __autoload($class); } if (isset($_GET['kill'])) { session_destroy(); session_start(); } echo '<pre>'; echo 'unserialize_callback_func: ' . ini_get('unserialize_callback_func') . "\n"; echo '$_SESSION: ' . "\n"; print_r($_SESSION); if (!isset($_SESSION['test'])) { $_SESSION['test'] = new MyClass; echo 'Created a ' . get_class($_SESSION['test']) . "\n"; echo '$_SESSION: ' . "\n"; print_r($_SESSION); } echo '<p><a href="?kill=true">Kill session</a></p>'; echo '<p><a href="' . $_SERVER['PHP_SELF'] . '">Reload</a></p>'; echo '</pre>'; ?> ** MyClass.php <?php class MyClass { public $test = 'TestValue'; } ?> Expected result: ---------------- During unserialization myCallBack should be called and a complete MyClass object should exist. $_SESSION = Array ( [test] => MyClass Object ( [test] => TestValue ) ) Actual result: -------------- $_SESSION = Array ( [test] => __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => MyClass [test] => TestValue ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37578&edit=1