当前位置: 代码迷 >> 综合 >> PHP5.4 升级到7.2后 phpLDAPadmin 报错
  详细解决方案

PHP5.4 升级到7.2后 phpLDAPadmin 报错

热度:55   发布时间:2024-01-31 10:06:45.0

我用的是phpLDAPadmin…与PHP 7.2和我注意到以下警告抛出:

Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /usr/share/phpldapadmin/lib/functions.php on line 54Deprecated: Function create_function() is deprecated in /usr/share/phpldapadmin/lib/functions.php on line 1083

解决办法:

/usr/share/phpldapadmin/lib/functions.php on line 54
change line 54 to "function my_autoload($className) {"
Add this code "spl_autoload_register("my_autoload");" on line 777/usr/share/phpldapadmin/lib/functions.php on line 1083change line 1083 to "$CACHE[$sortby] = __create_function('$a, $b',$code);"
add the code below from the 
http://php.net/manual/pt_BR/function.create-function.php page on line 1091function __create_function($arg, $body) {static $cache = array();static $maxCacheSize = 64;static $sorter;if ($sorter === NULL) {$sorter = function($a, $b) {if ($a->hits == $b->hits) {return 0;}return ($a->hits < $b->hits) ? 1 : -1;};}$crc = crc32($arg . "\\x00" . $body);if (isset($cache[$crc])) {++$cache[$crc][1];return $cache[$crc][0];}if (sizeof($cache) >= $maxCacheSize) {uasort($cache, $sorter);array_pop($cache);}$cache[$crc] = array($cb = eval('return 
function('.$arg.'){'.$body.'};'), 0);return $cb;
}