From 51eca2cdfccec6e7f194316e78493f22c27e0a92 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 13 Dec 2012 17:39:17 +0100 Subject: [PATCH] Fix matching of classes in trailing non-php text, fixes #1409 --- src/Composer/Autoload/ClassMapGenerator.php | 7 ++++++- .../Test/Autoload/Fixtures/template/template_3.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/Composer/Test/Autoload/Fixtures/template/template_3.php diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 5a74728f2..0a4db9bdc 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -121,7 +121,12 @@ class ClassMapGenerator $contents = preg_replace('{^.+?<\?}s', '.*<\?}s', '', $contents); + $contents = preg_replace('{\?>.+<\?}s', '?>'); + if (false !== $pos && false === strpos(substr($contents, $pos), ' + +class inner { } + + + +class trailing { } \ No newline at end of file