Explorar el Código

removed usage of preg_match with the 'e' modifier

Fabien Potencier hace 14 años
padre
commit
9fbffcc650

+ 1 - 1
src/Symfony/Component/DependencyInjection/Container.php

@@ -403,7 +403,7 @@ class Container implements ContainerInterface
      */
     static public function camelize($id)
     {
-        return preg_replace(array('/(?:^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\1')", "'_'.strtoupper('\\1')"), $id);
+        return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id);
     }
 
     /**

+ 1 - 1
src/Symfony/Component/Form/Util/PropertyPath.php

@@ -366,6 +366,6 @@ class PropertyPath implements \IteratorAggregate
 
     protected function camelize($property)
     {
-        return preg_replace(array('/(^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $property);
+        return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $property);
     }
 }

+ 1 - 1
src/Symfony/Component/HttpFoundation/HeaderBag.php

@@ -49,7 +49,7 @@ class HeaderBag
         }
 
         $beautifier = function ($name) {
-            return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", ucfirst($name));
+            return preg_replace_callback('/\-(.)/', function ($match) { return '-'.strtoupper($match[1]); }, ucfirst($name));
         };
 
         $max = max(array_map('strlen', array_keys($this->headers))) + 1;