diff options
-rw-r--r-- | it_auto_prepend.php | 4 |
1 files changed, 3 insertions, 1 deletions
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++) |