From f2c2eb24bfb7b9205d9c67449210d83308c1de78 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 2 May 2017 15:57:19 +0200 Subject: Remove shebang line when converting syntax in it_auto_prepend.php --- it_auto_prepend.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'it_auto_prepend.php') diff --git a/it_auto_prepend.php b/it_auto_prepend.php index cea5a0d..8589f9f 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -142,7 +142,9 @@ function it_convert($source) { if ($changed = filesize($source) < 200000) # Do not attempt to convert anything above 200k to avoid large memory consumption { - $converter = new it_syntaxconverter(file_get_contents($source)); + if (substr($code = file_get_contents($source), 0, 3) == '#!/') + $code = preg_replace('/^[^\r\n]*[\r\n]+/', '', $code); # Remove shebang line when converting syntax + $converter = new it_syntaxconverter($code); $parts = explode("/", dirname($converted)); for ($i = 1; $i <= count($parts); $i++) -- cgit v1.2.3