diff options
author | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2022-03-06 22:40:55 -0600 |
---|---|---|
committer | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2022-03-06 22:43:50 -0600 |
commit | a9c2430bd9f97ff6bfcc2daf9a791f549a1d2f9b (patch) | |
tree | 25447597f0ab9d0eb6369a4549a28440d1f68a09 /net/phpldapadmin/files/patch-lib_Visitor.php | |
parent | devel/R-cran-rlang: Update to 1.0.2 (diff) |
net/phpldapadmin: Fix runtime with php80
- Pet portclippy/portfmt
PR: 261990
Reported by: ohartmann@walstatt.org
Approved by: ports@bsdserwis.com (maintainer)
Sponsored by: Bounce Experts
Diffstat (limited to 'net/phpldapadmin/files/patch-lib_Visitor.php')
-rw-r--r-- | net/phpldapadmin/files/patch-lib_Visitor.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/net/phpldapadmin/files/patch-lib_Visitor.php b/net/phpldapadmin/files/patch-lib_Visitor.php new file mode 100644 index 000000000000..2ba2a552d833 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_Visitor.php @@ -0,0 +1,43 @@ +--- lib/Visitor.php.orig 2021-12-12 02:35:51 UTC ++++ lib/Visitor.php +@@ -22,6 +22,15 @@ abstract class Visitor { + protected $server_id; + + public function __call($method,$args) { ++ # This mapping array allows to map effective class names to ++ # function name suffixes. ++ # It has been introduced when class Attribute has been renamed ++ # to PLAAttribute to avoid a name clash with the built-in ++ # class of PHP 8. ++ # Entering a class name mapping here allows to rename the ++ # class without having to rename the methods too. ++ static $classmap = array('PLAAttribute' => 'Attribute'); ++ + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs); + +@@ -33,19 +42,14 @@ abstract class Visitor { + $fnct = array_shift($args); + + $object = $args[0]; +- $class = get_class($object); + +- $call = "$method$fnct$class"; +- +- array_push($methods,$call); +- +- while ($class && ! method_exists($this,$call)) { ++ for ($class = get_class($object); $class; $class = get_parent_class($class)) { ++ $call = isset($classmap[$class])? "$method$fnct$classmap[$class]": "$method$fnct$class"; ++ array_push($methods,$call); ++ if (method_exists($this,$call)) ++ break; + if (defined('DEBUGTMP') && DEBUGTMP) + printf('<font size=-2><i>Class (%s): Method doesnt exist (%s,%s)</i></font><br />',$class,get_class($this),$call); +- +- $class = get_parent_class($class); +- $call = "$method$fnct$class"; +- array_push($methods,$call); + } + + if (defined('DEBUGTMP') && DEBUGTMP) |