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-- Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance) --FILE--..

Decoded Output download

--TEST--
Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance)
--FILE--
<?php

class Bar extends ArrayObject {
    private $foo = array( 1, 2, 3 );
    function __construct()
    {
        parent::__construct($this->foo);
    }
}

$foo = new Bar();
var_dump($foo);
$foo['foo'] = 23;

$bar = new Bar();
var_dump($bar);

echo "Done
";
?>
--EXPECTF--
object(Bar)#%d (2) {
  ["foo":"Bar":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  ["storage":"ArrayObject":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
object(Bar)#%d (2) {
  ["foo":"Bar":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  ["storage":"ArrayObject":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
Done

Did this file decode correctly?

Original Code

--TEST--
Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance)
--FILE--
<?php

class Bar extends ArrayObject {
    private $foo = array( 1, 2, 3 );
    function __construct()
    {
        parent::__construct($this->foo);
    }
}

$foo = new Bar();
var_dump($foo);
$foo['foo'] = 23;

$bar = new Bar();
var_dump($bar);

echo "Done\n";
?>
--EXPECTF--
object(Bar)#%d (2) {
  ["foo":"Bar":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  ["storage":"ArrayObject":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
object(Bar)#%d (2) {
  ["foo":"Bar":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  ["storage":"ArrayObject":private]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
Done

Function Calls

None

Variables

None

Stats

MD5 b7bd705bf47f87f74b0e8d2bdb459ecb
Eval Count 0
Decode Time 89 ms