Hi again,
for Ubuntu 18.4 bionic LTS I cherry picked the following three commits from
https://github.com/leenooks/phpLDAPadmin
and build the appended php-7.2-compat.patch from that:
1.
https://github.com/leenooks/phpLDAPadmin/commit/49ef60f26b78a81dbaa9727be11ee3fb8db0b5bb
2.
https://github.com/leenooks/phpLDAPadmin/commit/73b7795bc0b232491de35dd91ad9ea86ad34eae8
3.
https://github.com/leenooks/phpLDAPadmin/commit/e37b498de19a5301188bc8d93b0b67d7ce717d3a
That works for me on bionic.
On newer releases this should also apply but you might need additional
commits/patches e.g.
Fix for PHP 7.3 - deprecated continue in switch
https://github.com/leenooks/phpLDAPadmin/commit/7b1f6b5132204836a75674045309edb7005b87d2
For Ubuntu 19.10 Eoan I would suggest to upgrade to a newer upstream version
from <https://github.com/leenooks/phpLDAPadmin>. As far as I can see this moved
from sourceforge to github not long ago, and the code base of phpldapadmin
you're relaying on seems to be quite old. ;-)
I'm also crossposting this patch suggestion to the debian bug, since the debian
packages are still containing the same issue as far as I can see. My launchpad
Bug for this is on
<https://bugs.launchpad.net/ubuntu/+source/phpldapadmin/+bug/1829987>.
Kind regargs,
Lars
--
Lars Kollstedt
Telefon: +49 6151 16-71027
E-Mail: l...@man-da.de
man-da.de GmbH
Dolivostraße 11
64293 Darmstadt
Sitz der Gesellschaft: Darmstadt
Amtsgericht Darmstadt, HRB 9484
Geschäftsführer: Andreas Ebert
diff -rupN phpldapadmin-1.2.2.orig/htdocs/index.php phpldapadmin-1.2.2.new/htdocs/index.php
--- phpldapadmin-1.2.2.orig/htdocs/index.php 2011-10-27 04:07:09.000000000 +0200
+++ phpldapadmin-1.2.2.new/htdocs/index.php 2019-05-21 16:32:31.590908479 +0200
@@ -57,6 +57,11 @@ if (defined('CONFDIR'))
else
$app['config_file'] = 'config.php';
+if (! is_readable($app['config_file'])) {
+ if (ob_get_level()) ob_end_clean();
+ die(sprintf("Missing configuration file <b>%s</b> - have you created it?",$app['config_file']));
+}
+
# Make sure this PHP install has session support
if (! extension_loaded('session'))
error('<p>Your install of PHP appears to be missing php-session support.</p><p>Please install php-session support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>','error',null,true);
diff -rupN phpldapadmin-1.2.2.orig/lib/functions.php phpldapadmin-1.2.2.new/lib/functions.php
--- phpldapadmin-1.2.2.orig/lib/functions.php 2019-05-21 15:55:51.000000000 +0200
+++ phpldapadmin-1.2.2.new/lib/functions.php 2019-05-21 16:33:19.062398072 +0200
@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom
/**
* Loads class definition
*/
-function __autoload($className) {
+function pla_autoload($className) {
if (file_exists(HOOKSDIR."classes/$className.php"))
require_once(HOOKSDIR."classes/$className.php");
elseif (file_exists(LIBDIR."$className.php"))
@@ -66,6 +66,12 @@ function __autoload($className) {
'type'=>'error'));
}
+if (version_compare(phpversion(), '7.0', '>=')) {
+ spl_autoload_register('pla_autoload');
+} else {
+ eval('function __autoload($className) {pla_autoload($className);}');
+}
+
/**
* Strips all slashes from the specified array in place (pass by ref).
* @param Array The array to strip slashes from, typically one of
@@ -994,6 +1000,23 @@ function get_custom_file($index,$filenam
}
/**
+ * Replacement for create_function() which is deprecated as of php 7.2
+ *
+ * @param string The function arguments
+ * @param string The function code
+ */
+function pla_create_function($args, $code) {
+ if (version_compare(phpversion(),'7.0','>=')) {
+ # anonymous functions were introduced in PHP 5.3.0
+ return eval("return function(".$args."){".$code."};");
+
+ } else {
+ # create_function is deprecated in php 7.2
+ return create_function($args, $code);
+ }
+}
+
+/**
* Sort a multi dimensional array.
*
* @param array Multi demension array passed by reference
@@ -1080,7 +1103,7 @@ function masort(&$data,$sortby,$rev=0) {
$code .= 'return $c;';
- $CACHE[$sortby] = create_function('$a, $b',$code);
+ $CACHE[$sortby] = pla_create_function('$a, $b',$code);
}
uasort($data,$CACHE[$sortby]);