From ce70e0e9dd63e4f3fcdd0eb2d960873d160a3a2f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 4 Jan 2018 13:33:31 +0100 Subject: [PATCH 1/3] Fix BC of generated static map --- src/Composer/Autoload/AutoloadGenerator.php | 5 +---- src/Composer/Autoload/ClassLoader.php | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index dca6a7553..87b250617 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -785,10 +785,7 @@ HEADER; // BC handling when converting to a new ClassLoader if (isset($maps['prefixLengthsPsr4'])) { - $maps['firstCharsPsr4'] = array_map(function () { - return true; - }, $maps['prefixLengthsPsr4']); - unset($maps['prefixLengthsPsr4']); + $maps['firstCharsPsr4'] = array_map('is_array', $maps['prefixLengthsPsr4']); } foreach ($maps as $prop => $value) { diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index bebe83706..c6f6d2322 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -44,6 +44,7 @@ class ClassLoader { // PSR-4 private $firstCharsPsr4 = array(); + private $prefixLengthsPsr4 = array(); // For BC with legacy static maps private $prefixDirsPsr4 = array(); private $fallbackDirsPsr4 = array(); @@ -371,15 +372,15 @@ class ClassLoader $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; $first = $class[0]; - if (isset($this->firstCharsPsr4[$first])) { + if (isset($this->firstCharsPsr4[$first]) || isset($this->prefixLengthsPsr4[$first])) { $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = substr($logicalPathPsr4, $lastPos + 1); + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $pathEnd)) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } From b0fa2bd5e20b5300cdfe977678eea315e96df9a3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 4 Jan 2018 13:49:44 +0100 Subject: [PATCH 2/3] Fix dependency on seld/jsonlint 1.4 As deprecated flag is used. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 30d9f91dd..74030a47b 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", "composer/ca-bundle": "^1.0", "composer/semver": "^1.0", - "composer/spdx-licenses": "^1.0", + "composer/spdx-licenses": "^1.2", "seld/jsonlint": "^1.4", "symfony/console": "^2.7 || ^3.0 || ^4.0", "symfony/finder": "^2.7 || ^3.0 || ^4.0", From 5e223dae61b7b04ad4cf8361cb60ab76d07a63f8 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 4 Jan 2018 14:27:50 +0100 Subject: [PATCH 3/3] Update jsonlint dep --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 23915cf61..1ab5c6c33 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d3c8dbadf8d41e2c7933e274b2fe1327", + "content-hash": "8c8fe8c8c57c958b318515f636a6839e", "packages": [ { "name": "composer/ca-bundle", @@ -348,23 +348,23 @@ }, { "name": "seld/jsonlint", - "version": "1.6.2", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19" + "reference": "9b355654ea99460397b89c132b5c1087b6bf4473" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19", - "reference": "7a30649c67ee0d19faacfd9fa2cfb6cc032d9b19", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9b355654ea99460397b89c132b5c1087b6bf4473", + "reference": "9b355654ea99460397b89c132b5c1087b6bf4473", "shasum": "" }, "require": { "php": "^5.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "bin": [ "bin/jsonlint" @@ -393,7 +393,7 @@ "parser", "validator" ], - "time": "2017-11-30T15:34:22+00:00" + "time": "2018-01-03T12:13:57+00:00" }, { "name": "seld/phar-utils",