无法创建新条目。PHPLDAPADMIN

Jir*_*Vít 1 ldap phpldapadmin

我刚刚安装了LDAP和PHPLDAPADMIN。它可以正常工作,但是当我想要创建新条目页面时只需刷新就什么也没有发生。有一些错误:

无法识别的错误号:8192:不建议使用函数create_function()

phpldapadmin中的错误

谢谢。

Sen*_*hil 5

尝试此代码可以正常工作。

第54行的/usr/share/phpldapadmin/lib/functions.php

将第54行更改为

function my_autoload($className) {
Run Code Online (Sandbox Code Playgroud)

在第777行添加此代码

spl_autoload_register("my_autoload"); 
Run Code Online (Sandbox Code Playgroud)

将1083行更改为

$CACHE[$sortby] = __create_function('$a, $b',$code);
Run Code Online (Sandbox Code Playgroud)

从第1091行添加以下代码

   function __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;
    }
Run Code Online (Sandbox Code Playgroud)

终于重启你的Apache服务器 sudo service apache2 restart


小智 2

PhpLdapAdmin 使用了一些在 PHP 7.2 中已弃用的函数。看看这个修复: https://bugs.debian.org/cgi-bin/bugreport.cgi ?bug=890127