|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-05-24 13:32 UTC] tacker@php.net
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
)
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 09:00:01 2025 UTC |
Speaking in PHP code you're actually doing: session_start(); ini_set("unserialize_callback_func", "myCallback"); Anyway, this is a support question, not a bug.