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 #60139 (Anonymous functions create cycles not detected by the GC) --INI-- zen..

Decoded Output download

--TEST--
Bug #60139 (Anonymous functions create cycles not detected by the GC)
--INI--
zend.enable_gc=1
--FILE--
<?php
class Foo {
    public $x;

    public function __construct() {
        $this->x = function() {};
    }
}

class Bar {
    public $x;

    public function __construct() {
        $self = $this;
        $this->x = function() use ($self) {};
    }
}

gc_collect_cycles();
new Foo;
var_dump(gc_collect_cycles());
new Bar;
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(2)
int(2)

Did this file decode correctly?

Original Code

--TEST--
Bug #60139 (Anonymous functions create cycles not detected by the GC)
--INI--
zend.enable_gc=1
--FILE--
<?php
class Foo {
    public $x;

    public function __construct() {
        $this->x = function() {};
    }
}

class Bar {
    public $x;

    public function __construct() {
        $self = $this;
        $this->x = function() use ($self) {};
    }
}

gc_collect_cycles();
new Foo;
var_dump(gc_collect_cycles());
new Bar;
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(2)
int(2)

Function Calls

None

Variables

None

Stats

MD5 121fc0978858bec188c537d6aaabad72
Eval Count 0
Decode Time 81 ms