pk-fr / yakpro-po

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

obfuscation breaks array access in some cases #55

Closed DooMMasteR closed 4 years ago

DooMMasteR commented 4 years ago
    public function getMapped(bool $named = false): array {
      $types = Duffs::getTypes();
      $clients = [];
      if(in_array("duff", $licenseTypes)){
          if($named){
              $clients["duff"] = $this->duff;
          } else {
              $clients[array_search("duff", $types)] = $this->duff;
          }
      }
      return $clients;
    }

this will end up of being assigned a null value for some reason, the array position will exist for my case as types is fine, but for some reason the assignment wont work

    public function getMapped(bool $KAqAA = false): array {
        goto uAVh4;
        mCkRt:
        $GhFDC["\x64\165\x66\146"] = $this->Y2GpO;
        goto OC0IH;
        xVc1l:
        if ($KAqAA) {
            goto W2Cf3;
        }
        goto SVjBD;
        BkqXo:
        return $GhFDC;
        goto JfBez;
        XvXVQ: W2Cf3:
        goto mCkRt;
        faMB6:
        $GhFDC = [];
        goto b5s0K;
        OC0IH: a5y0c:
        goto DJ1OH;
        SVjBD:
        $GhFDC[array_search("\144\x75\146\x66", $iYKZc)] = $this->Y2GpO;
        goto R6kua;
        DJ1OH: kmVls:
        goto BkqXo;
        uAVh4:
        $Ds0TU = Duffs::getTypes();
        goto faMB6;
        R6kua:
        goto a5y0c;
        goto XvXVQ;
        b5s0K:
        if (!in_array("\144\165\x66\146", $Ds0TU)) {
            goto kmVls;
        }
        goto xVc1l;
        JfBez:
    }

I think the issue is deeper, because the data is retrieved from an Object. and the Method also gets obfuscated though the obfuscator has no concept of the objects contents.

    private function mapData(Object $data) : void{
      $this->duff = $data->duff;
    }

$data is JSON parsed via json_decode() so a native PHP object

but it becomes obfuscated too

    private function mapData(Object $mMRNs): void {
        $this->dM_Iz = $mMRNs->dM_Iz;
    }

Where dM_lz should stay duff because the object map stays the same even if obfuscated.

pk-fr commented 4 years ago

I think the issue is deeper, because the data is retrieved from an Object. and the Method also gets obfuscated though the obfuscator has no concept of the objects contents.

you are right! this could not work with obfuscation!

see " Hints for preparing your Software to be run obfuscated" section of readme.md ... ( same for Do not use PDO::FETCH_OBJ but use PDO::FETCH_ASSOC instead! or disable properties obfuscation in the config file. )