Pārlūkot izejas kodu

Optimize the regex detecting timestamps

Using a possessive quantifier avoids useless backtracking.
Christophe Coevoet 9 gadi atpakaļ
vecāks
revīzija
a014a2f803
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/Composer/Package/Loader/ArrayLoader.php

+ 1 - 1
src/Composer/Package/Loader/ArrayLoader.php

@@ -147,7 +147,7 @@ class ArrayLoader implements LoaderInterface
         }
 
         if (!empty($config['time'])) {
-            $time = preg_match('/^\d+$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
+            $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
 
             try {
                 $date = new \DateTime($time, new \DateTimeZone('UTC'));