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

Error when parsing octal notation #21

Open
y0no opened this issue Apr 20, 2016 · 3 comments
Open

Error when parsing octal notation #21

y0no opened this issue Apr 20, 2016 · 3 comments

Comments

@y0no
Copy link

y0no commented Apr 20, 2016

Hi,
Thank you for this great project! I use it to deobfuscate some PHP code. I have recently tried with a valid PHP code that cannot be parsed by phply. Here is the code:

<?php

function foo($value) {
    echo $value;
}

foo(0987654321);

It seems that when an invalid octal variablle is passed to PHP, is value is modified to 0. Things that phply does not handle.

@y0no
Copy link
Author

y0no commented May 1, 2016

Here is the pull request: #22

@viraptor
Copy link
Owner

viraptor commented Nov 7, 2016

Thanks for the patch @y0no !
It seems that new versions of php (>=7) turn invalid octal numbers into a syntax error, so there's no good way to seamlessly support both "correct" behaviours.

One way I see that could potentially fix this is to basically have a v5/v7 switch, but that would essentially require 2 separate parsers. I'd rather support the current version properly.
Alternatively there could be relaxed/strict mode if there are enough edge cases for it.

Have you got a preferred approach or other ideas?

@Alexey-T
Copy link

Better add global var (in the phply module) like PHPLY_PHP_VERSION which can be 'Pre7', '7+' etc.

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