From 5a01ada383b689f6901026dad00837d32d4c3a52 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 25 Nov 2012 14:07:06 +0100 Subject: [PATCH] Restrict unicode chars allowed to what php core allows, refs #1361 --- src/Composer/Autoload/ClassMapGenerator.php | 6 +++--- tests/Composer/Test/Autoload/ClassMapGeneratorTest.php | 2 +- tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index f79c23526..bebf7c7e3 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -125,10 +125,10 @@ class ClassMapGenerator preg_match_all('{ (?: - \b(?])(?class|interface'.$traits.') \s+ (?[^\s\{]+) - | \b(?])(?namespace) (?\s+[^\s;{}\\\\]+(?:\s*\\\\\s*[^\s;{}\\\\]+)*)? \s*[\{;] + \b(?])(?class|interface'.$traits.') \s+ (?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*) + | \b(?])(?namespace) (?\s+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\s*\\\\\s*[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*)? \s*[\{;] ) - }iux', $contents, $matches); + }ix', $contents, $matches); $classes = array(); $namespace = ''; diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 3aea3a730..2f05e60b6 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -54,7 +54,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase 'Foo\\LargeClass' => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php', 'Foo\\LargeGap' => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php', 'Foo\\MissingSpace' => realpath(__DIR__).'/Fixtures/classmap/MissingSpace.php', - 'Unicode\\↑' => realpath(__DIR__).'/Fixtures/classmap/Unicode.php', + 'Unicode\\↑\\↑' => realpath(__DIR__).'/Fixtures/classmap/Unicode.php', )), array(__DIR__.'/Fixtures/template', array()), ); diff --git a/tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php b/tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php index ddd9359cf..5f96dec59 100644 --- a/tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php +++ b/tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php @@ -1,6 +1,6 @@