1
0
Fork 0

Restrict unicode chars allowed to what php core allows, refs #1361

pull/1366/head
Jordi Boggiano 2012-11-25 14:07:06 +01:00
parent 2d7c3c9d27
commit 5a01ada383
3 changed files with 5 additions and 5 deletions

View File

@ -125,10 +125,10 @@ class ClassMapGenerator
preg_match_all('{ preg_match_all('{
(?: (?:
\b(?<![\$:>])(?<type>class|interface'.$traits.') \s+ (?<name>[^\s\{]+) \b(?<![\$:>])(?<type>class|interface'.$traits.') \s+ (?<name>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)
| \b(?<![\$:>])(?<ns>namespace) (?<nsname>\s+[^\s;{}\\\\]+(?:\s*\\\\\s*[^\s;{}\\\\]+)*)? \s*[\{;] | \b(?<![\$:>])(?<ns>namespace) (?<nsname>\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(); $classes = array();
$namespace = ''; $namespace = '';

View File

@ -54,7 +54,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
'Foo\\LargeClass' => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php', 'Foo\\LargeClass' => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php',
'Foo\\LargeGap' => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php', 'Foo\\LargeGap' => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php',
'Foo\\MissingSpace' => realpath(__DIR__).'/Fixtures/classmap/MissingSpace.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()), array(__DIR__.'/Fixtures/template', array()),
); );

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Unicode; namespace Unicode\↑;
class { class {
} }