From 4bd0a820d1ed1f8713be141ad56cf5362f83a524 Mon Sep 17 00:00:00 2001 From: Yahnis Elsts Date: Wed, 14 Oct 2020 19:13:02 +0300 Subject: [PATCH] Move code that prefixes the API class with the current namespace so that getCompatibleClassVersion() gets the unprefixed name. Alternative fix for the problem described in #396. --- Puc/v4p10/Factory.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Puc/v4p10/Factory.php b/Puc/v4p10/Factory.php index 01ed848..2168ea7 100644 --- a/Puc/v4p10/Factory.php +++ b/Puc/v4p10/Factory.php @@ -114,9 +114,6 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): //Add the current namespace to the class name(s). if ( version_compare(PHP_VERSION, '5.3', '>=') ) { $checkerClass = __NAMESPACE__ . '\\' . $checkerClass; - if ( isset($apiClass) ) { - $apiClass = __NAMESPACE__ . '\\' . $apiClass; - } } if ( !isset($apiClass) ) { @@ -134,6 +131,10 @@ if ( !class_exists('Puc_v4p10_Factory', false) ): return null; } + if ( version_compare(PHP_VERSION, '5.3', '>=') && (strpos($apiClass, '\\') === false) ) { + $apiClass = __NAMESPACE__ . '\\' . $apiClass; + } + return new $checkerClass( new $apiClass($metadataUrl), $id,