pk-fr / yakpro-po

YAK Pro - Php Obfuscator
http://www.php-obfuscator.com
Other
1.27k stars 354 forks source link

problem with global vars ! #52

Closed Etken2016 closed 4 years ago

Etken2016 commented 4 years ago

I have problem with code after obfuscation if It has a variables in global array : this original : `<?php ini_set("display_errors",true); class cc { function ee (){ echo ("test"); } } $GLOBALS["xc"] = new cc();

function vv (){ global $xc; $xc->ee(); } vv();

?>`

this after modify : <?php /* __________________________________________________ | Obfuscated by YAK Pro - Php Obfuscator 2.0.4 | | on 2020-01-09 14:47:59 | | GitHub: https://github.com/pk-fr/yakpro-po | |__________________________________________________| */ goto TWmXm; I1BoU: $GLOBALS["xc"] = new cc(); goto aNeS0; TWmXm: ini_set("display_errors", true); goto IHi_O; IHi_O: class cc { function ee() { echo "test"; } } goto I1BoU; aNeS0: function qtRlm() { global $SyCuk; $SyCuk->ee(); } goto HOmQB; HOmQB: QTrLM();

when run , it's show error :

PHP Fatal error: Uncaught Error: Call to a member function ee() on null

Is there any config for solve this problem ?

Etken2016 commented 4 years ago

is there way , to exclude all global vars ?

pk-fr commented 4 years ago

there is no problems with global vars.... you are instanciating a global variable using a string for its name.... its just not working for obfuscation ( same as indirect variables or indirect function calls. )

change your source code by replacing $GLOBALS["xc"] = new cc(); by global $xc; $xc = new cc(); and it will work as expected!