pk-fr / yakpro-po

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

Bug: Function definition in "parse" time instead of execution time #46

Closed lucasexe closed 4 years ago

lucasexe commented 5 years ago

If I have this code:

a.php:

function f() {
  echo 'test';
}
include('b.php');

b.php:

if (!function_exists('f')) {
   function f() {
       echo 'test2';
   }
}

When the option shuffle_stmts is enabled, the definition of f() in b.php will be appear out of the if, therefore the php interpreter will try to define the function in "parse" time instead of execution time, and this will throw the error below:

PHP Fatal error:  Cannot redeclare f() in b.php on line 2

Maybe we can just add an if (true) in these situations.

pk-fr commented 4 years ago

cannot reproduce...