diff --git a/lib/AttributeFactory.php b/lib/AttributeFactory.php index 82cf562..96bb70b 100644 --- a/lib/AttributeFactory.php +++ b/lib/AttributeFactory.php @@ -133,7 +133,7 @@ class AttributeFactory { return $this->newGidAttribute($name,$values,$server_id,$source); } else { - return new Attribute($name,$values,$server_id,$source); + return new PLAAttribute($name,$values,$server_id,$source); } } diff --git a/lib/BinaryAttribute.php b/lib/BinaryAttribute.php index 6b5053b..35fe5d2 100644 --- a/lib/BinaryAttribute.php +++ b/lib/BinaryAttribute.php @@ -12,7 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ -class BinaryAttribute extends Attribute { +class BinaryAttribute extends PLAAttribute { protected $filepaths; protected $filenames; diff --git a/lib/DateAttribute.php b/lib/DateAttribute.php index e1a687f..df0b6e8 100644 --- a/lib/DateAttribute.php +++ b/lib/DateAttribute.php @@ -12,6 +12,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class DateAttribute extends Attribute { +class DateAttribute extends PLAAttribute { } ?> diff --git a/lib/DnAttribute.php b/lib/DnAttribute.php index 1f5c02f..692ec65 100644 --- a/lib/DnAttribute.php +++ b/lib/DnAttribute.php @@ -12,6 +12,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class DnAttribute extends Attribute { +class DnAttribute extends PLAAttribute { } ?> diff --git a/lib/GidAttribute.php b/lib/GidAttribute.php index 7442a07..4ea0d12 100644 --- a/lib/GidAttribute.php +++ b/lib/GidAttribute.php @@ -12,6 +12,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class GidAttribute extends Attribute { +class GidAttribute extends PLAAttribute { } ?> diff --git a/lib/MultiLineAttribute.php b/lib/MultiLineAttribute.php index b6d0eb5..2da4bb9 100644 --- a/lib/MultiLineAttribute.php +++ b/lib/MultiLineAttribute.php @@ -12,7 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ -class MultiLineAttribute extends Attribute { +class MultiLineAttribute extends PLAAttribute { protected $rows = 0; protected $cols = 0; diff --git a/lib/ObjectClassAttribute.php b/lib/ObjectClassAttribute.php index 939094d..7807098 100644 --- a/lib/ObjectClassAttribute.php +++ b/lib/ObjectClassAttribute.php @@ -12,6 +12,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class ObjectClassAttribute extends Attribute { +class ObjectClassAttribute extends PLAAttribute { } ?> diff --git a/lib/Attribute.php b/lib/PLAAttribute.php similarity index 99% rename from lib/Attribute.php rename to lib/PLAAttribute.php index 9c4ef98..313b42a 100644 --- a/lib/Attribute.php +++ b/lib/PLAAttribute.php @@ -12,7 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ -class Attribute { +class PLAAttribute { # Attribute Name public $name; # Source of this attribute definition diff --git a/lib/PasswordAttribute.php b/lib/PasswordAttribute.php index 2667197..5971576 100644 --- a/lib/PasswordAttribute.php +++ b/lib/PasswordAttribute.php @@ -12,6 +12,6 @@ * @package phpLDAPadmin * @subpackage Templates */ -class PasswordAttribute extends Attribute { +class PasswordAttribute extends PLAAttribute { } ?> diff --git a/lib/SelectionAttribute.php b/lib/SelectionAttribute.php index 5f1c8bb..dfb13c7 100644 --- a/lib/SelectionAttribute.php +++ b/lib/SelectionAttribute.php @@ -12,7 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ -class SelectionAttribute extends Attribute { +class SelectionAttribute extends PLAAttribute { protected $selection = array(); protected $multiple; protected $default; diff --git a/lib/ShadowAttribute.php b/lib/ShadowAttribute.php index eeb7cd1..0dcf915 100644 --- a/lib/ShadowAttribute.php +++ b/lib/ShadowAttribute.php @@ -12,7 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ -class ShadowAttribute extends Attribute { +class ShadowAttribute extends PLAAttribute { public $shadow_before_today_attrs = array('shadowLastChange','shadowMin'); public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive'); } diff --git a/lib/Visitor.php b/lib/Visitor.php index fca5099..b840e7b 100644 --- a/lib/Visitor.php +++ b/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('Class (%s): Method doesnt exist (%s,%s)
',$class,get_class($this),$call); - - $class = get_parent_class($class); - $call = "$method$fnct$class"; - array_push($methods,$call); } if (defined('DEBUGTMP') && DEBUGTMP)