naneau/php-obfuscator

Error when obfuscating third party library Swift

peterkaufmanenator opened this issue · 2 comments

There seems to be an issue when obfuscating the 3rd party PHP library Swift.

The error output is as follows:

Obfuscating /example.com/apps/backend/lib/Swift-4.0.3/test-suite/lib/Sweety/Runner/HtmlRunner.php
PHP Warning: strlen() expects parameter 1 to be string, object given in /home/prime/php-obfuscator/src/Naneau/Obfuscator/Node/Visitor/Scrambler.php on line 67
PHP Catchable fatal error: Object of class PhpParser\Node\Expr\Variable could not be converted to string in /home/prime/php-obfuscator/src/Naneau/Obfuscator/StringScrambler.php on line 53

Wonder if it is as simple as wrapping the call in question inside of a try-catch block and just returning the $node as is if the scramble call fails.

Happy to take a swing at this particular issue myself, if you think the above could work.

This seems to be a duplicate of #2

Fixed in #8