1
0
Fork 0

Fix matching of classes in trailing non-php text, fixes #1409

pull/1420/head
Jordi Boggiano 2012-12-13 17:39:17 +01:00
parent b0b9c7b0d1
commit 51eca2cdfc
2 changed files with 16 additions and 1 deletions

View File

@ -121,7 +121,12 @@ class ClassMapGenerator
$contents = preg_replace('{^.+?<\?}s', '<?', $contents);
}
// 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), '<?')) {
$contents = substr($contents, 0, $pos);
}
preg_match_all('{
(?:

View File

@ -0,0 +1,10 @@
class leading { }
<?php echo $queryClass ?>
class inner { }
<?php echo $defaultLocale ?>
class trailing { }