pk-fr / yakpro-po

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

Missing instanceof support #15

Closed jopelope closed 8 years ago

jopelope commented 8 years ago

Class names in expression "instanceof " are not obfuscated.

Patch suggestion: /includes/classes/parser_extensions/my_node_visitor.php

+214:
|| ($node instanceof PhpParser\Node\Expr\Instanceof_)

+569
if ($node instanceof PhpParser\Node\Expr\Instanceof_)
            {
                if (isset($node->{'class'}->parts))
                {
                    $parts = $node->{'class'}->parts;
                    for($i=0;$i<count($parts)-1;++$i)
                    {
                        $name  = $parts[$i];
                        if ( is_string($name) && (strlen($name) !== 0) )
                        {
                            $r = $scrambler->scramble($name);
                            if ($r!==$name)
                            {
                                $node->{'class'}->parts[$i] = $r;
                                $node_modified = true;
                            }
                        }
                    }
                }
            }
pk-fr commented 8 years ago

Hi jopelope,

thank you for your feedback...

I trusted your patch (no time for testing for now), just shrinked it a little bit...

Fixed in 1.8.8

cheers.