naneau/php-obfuscator

improvement: Ignore variable names beginning by ...

Opened this issue · 3 comments

In my project, I work with indirect function names or variable names.... ( i.e. $$v = 'xxx')
they all start with a prefix .

is it possible to add a joker in
obfuscator.scramble_variable.ignore: (and obfuscator.scramble_private_method.ignore:)

  • foo*

meaning variable (or function) starting by foo

I have started looking at your code....
perhaps could be optimized :

  • using 2 arrays : 1 for ignore, and 1 for ignore_starting_with...
  • using array_keys instead of values ( isset is far more efficient than in_array, when hundreeds of variables are to be ignored)

Perhaps a regular expression for variable names could be implemented, it would solve this problem. In general, however, you'll find that variable variables will cause problems with this kind of obfuscation.

It would be great :)