Browse Source

Optimize template for striping non-php blocks

zakonnic 5 years ago
parent
commit
9f6e45051a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/Composer/Autoload/ClassMapGenerator.php

+ 1 - 1
src/Composer/Autoload/ClassMapGenerator.php

@@ -173,7 +173,7 @@ class ClassMapGenerator
             }
         }
         // strip non-php blocks in the file
-        $contents = preg_replace('{\?>.+?<\?}s', '?><?', $contents);
+        $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
         // strip trailing non-php code if needed
         $pos = strrpos($contents, '?>');
         if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {