Skip to content

Commit e8706d5

Browse files
committed
create-phar: improved <script> extraction
1 parent c50ef6e commit e8706d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/create-phar/create-phar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
$s = preg_replace_callback('#<\?(?:php|=) (require |readfile\(|.*file_get_contents\().*?(/.+\.(js|css))\'\)* \?>#', function ($m) use ($file) {
2727
return file_get_contents($file->getPath() . $m[2]);
2828
}, $s);
29-
$s = preg_replace_callback('#(<(script|style).*>)(.*)(</)#Uis', function ($m) {
29+
$s = preg_replace_callback('#(<(script|style).*(?<!\?)>)(.*)(</)#Uis', function ($m) {
3030
list(, $begin, $type, $s, $end) = $m;
3131

32-
if (strpos($s, '<?') !== FALSE) {
32+
if ($s === '' || strpos($s, '<?') !== FALSE) {
3333
return $m[0];
3434

3535
} elseif ($type === 'script' && function_exists('curl_init')) {

0 commit comments

Comments
 (0)