Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converter doesn't work on files with short open tag on a system with disabled short open tag #16

Open
SergeAx opened this issue Jul 25, 2016 · 3 comments

Comments

@SergeAx
Copy link

SergeAx commented Jul 25, 2016

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.

@philip
Copy link
Owner

philip commented Aug 10, 2016

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.

@philip
Copy link
Owner

philip commented Sep 23, 2016

Related: the README was updated with information about this limitation. Leaving this bug open as adding a <? detector may still be added.

@JTBrinkmann
Copy link
Contributor

I think this issue can be closed, given the README update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants