diff --git a/resources/core-scoper.inc.php b/resources/core-scoper.inc.php index fef3f3a..2cc4162 100644 --- a/resources/core-scoper.inc.php +++ b/resources/core-scoper.inc.php @@ -77,6 +77,17 @@ 'prefix' => 'Matomo\\Dependencies', 'finders' => $finders, 'patchers' => [ + // patchers for PEAR (pear libraries do not use psr autoloading and put everything in a global namespace, + // so we can't automatically rename references to PEAR libraries) + static function (string $filePath, string $prefix, string $content) use ($isRenamingReferences): string { + if (!$isRenamingReferences) { + return $content; + } + + $content = preg_replace('/([^\\\\A-Za-z0-9_])\\\\PEAR_/', '$1\\Matomo\\Dependencies\\PEAR_', $content); + return $content; + }, + // patchers for twig static function (string $filePath, string $prefix, string $content) use ($isRenamingReferences): string { // correct use statements in generated templates diff --git a/src/Prefixers/CorePrefixer.php b/src/Prefixers/CorePrefixer.php index b8e3fa0..592626d 100644 --- a/src/Prefixers/CorePrefixer.php +++ b/src/Prefixers/CorePrefixer.php @@ -25,6 +25,11 @@ class CorePrefixer extends Prefixer 'symfony/console', // new version now depends on service-contracts which symfony/monolog-bridge also depends on 'php-di/php-di', 'geoip2/geoip2', + 'pear/pear_exception', + 'pear/archive_tar', + 'pear/console_getopt', + 'pear/pear-core-minimal', + 'pear/pear_exception', ]; const DEPENDENCIES_TO_IGNORE = [