File tree 3 files changed +48
-0
lines changed
src/Symfony/Component/HttpKernel
3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,9 @@ public function getName()
302
302
{
303
303
if (null === $ this ->name ) {
304
304
$ this ->name = preg_replace ('/[^a-zA-Z0-9_]+/ ' , '' , basename ($ this ->rootDir ));
305
+ if (ctype_digit ($ this ->name [0 ])) {
306
+ $ this ->name = '_ ' .$ this ->name ;
307
+ }
305
308
}
306
309
307
310
return $ this ->name ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Component \HttpKernel \Tests \Fixtures \_123 ;
13
+
14
+ use Symfony \Component \HttpKernel \Kernel ;
15
+ use Symfony \Component \Config \Loader \LoaderInterface ;
16
+
17
+ class Kernel123 extends Kernel
18
+ {
19
+ public function registerBundles ()
20
+ {
21
+ return array ();
22
+ }
23
+
24
+ public function registerContainerConfiguration (LoaderInterface $ loader )
25
+ {
26
+ }
27
+
28
+ public function getCacheDir ()
29
+ {
30
+ return sys_get_temp_dir ().'/ ' .Kernel::VERSION .'/kernel123/cache/ ' .$ this ->environment ;
31
+ }
32
+
33
+ public function getLogDir ()
34
+ {
35
+ return sys_get_temp_dir ().'/ ' .Kernel::VERSION .'/kernel123/logs ' ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change @@ -762,6 +762,14 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface()
762
762
$ kernel ->terminate (Request::create ('/ ' ), new Response ());
763
763
}
764
764
765
+ public function testKernelRootDirNameStartingWithANumber ()
766
+ {
767
+ $ dir = __DIR__ .'/Fixtures/123 ' ;
768
+ require_once $ dir .'/Kernel123.php ' ;
769
+ $ kernel = new \Symfony \Component \HttpKernel \Tests \Fixtures \_123 \Kernel123 ('dev ' , true );
770
+ $ this ->assertEquals ('_123 ' , $ kernel ->getName ());
771
+ }
772
+
765
773
/**
766
774
* Returns a mock for the BundleInterface.
767
775
*
You can’t perform that action at this time.
0 commit comments