Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- __sleep() returning undefined declared properties --FILE-- <?php class Test { ..

Decoded Output download

--TEST--
__sleep() returning undefined declared properties
--FILE--
<?php

class Test {
    public $pub;
    protected $prot;
    private $priv;

    public function __construct() {
        unset($this->pub, $this->prot, $this->priv);
    }

    public function __sleep() {
        return ['pub', 'prot', 'priv'];
    }
}

var_dump(serialize(new Test));

?>
--EXPECTF--
Warning: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d

Warning: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d

Warning: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d
string(15) "O:4:"Test":0:{}"

Did this file decode correctly?

Original Code

--TEST--
__sleep() returning undefined declared properties
--FILE--
<?php

class Test {
    public $pub;
    protected $prot;
    private $priv;

    public function __construct() {
        unset($this->pub, $this->prot, $this->priv);
    }

    public function __sleep() {
        return ['pub', 'prot', 'priv'];
    }
}

var_dump(serialize(new Test));

?>
--EXPECTF--
Warning: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d

Warning: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d

Warning: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d
string(15) "O:4:"Test":0:{}"

Function Calls

None

Variables

None

Stats

MD5 5fbe3b9e9dc26a5461fb8a787fcd2885
Eval Count 0
Decode Time 98 ms