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

Class method should be obfuscated to same string as its class, if it is the class constructor #78

Open
sedimentation-fault opened this issue Jul 5, 2020 · 0 comments

Comments

@sedimentation-fault
Copy link

Suppose you have

class x {

function x() {
...
}

}

that is, you have a class method with the same name as the class. Prior to PHP 5.x, this was the standard way to define the class constructor - today we would use __construct(). If you have class and method obfuscation turned on, then class x will be renamed to a different name than its constructor method x(). Thus, x() will cease to be a constructor in the obfuscated program, as its new name will not match the new class name.

I consider this a bug, because using class-named methods as constructors does not throw any error in PHP 7.x. So if you want to be thorough, this should be corrected.

One could argue, of course, that we can (or should) ignore such method and class names for both class and method obfuscation. This is true, but it is a PITA if you have thousands of files.

Besides, it is a very nasty bug, because it took me two days to find out what is going on, namely that the constructor was not being executed, because it ceased being a constructor in the obfuscated script! 😱

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

1 participant