Converter doesn't work on files with short open tag on a system with disabled short open tag
SergeAx opened this issue · 3 comments
If my file starts with <?
instead of <?php
AND php.ini has short_open_tag = off - converter just skips the file with message:
Status: OK
Number of mysql_-functions found: 0
Number of mysql_-functions converted: 0
Warnings/Errors: 0
Code length: 72 Bytes
Backup created.
File updated/modified.
Switches were: -u -v -b -w
Windows 7, PHP 5.6.7.
Interesting. I believe this is a limitation of the tokenizer extension. If short tags are disabled, then the tokenizer is unaware of <?, and as such, won't properly parse the file.
I don't think anything can be done about this aside from rewriting the application to not use tokenizer. Having the code convert <? to <?php is one option but it may offer too many bugs and/or be problematic. Something worth researching, though.
I'm not sure what the best option is here, but checking the first line for <? instead of <?php is one option, which would then output a fatal error. But, inline usage of <? will still be ignored....
Perhaps someone will come up with a solution for this, but for now I'm not sure. It is worth addressing though, as <? is common in old code.
Related: the README was updated with information about this limitation. Leaving this bug open as adding a <? detector may still be added.
I think this issue can be closed, given the README update