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 #79710: Reproducible segfault in error_handler during GC involved an SplFileO..
Decoded Output download
--TEST--
Bug #79710: Reproducible segfault in error_handler during GC involved an SplFileObject
--FILE--
<?php
class Target
{
public $sfo;
public function __construct($sfo) {
$this->sfo = $sfo;
}
public function __destruct() {
// If the SplFileObject is destructed first,
// underlying FD is no longer valid and will cause error upon calling flock
$this->sfo->flock(2);
}
}
class Run
{
static $sfo;
static $foo;
public static function main() {
// Creation ordering is important for repro
// $sfo needed to be destructed before $foo.
Run::$sfo = new SplTempFileObject();
Run::$foo = new Target(Run::$sfo);
}
}
Run::main();
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): SplFileObject->flock(2)
#1 [internal function]: Target->__destruct()
#2 {main}
thrown in %s on line %d
Did this file decode correctly?
Original Code
--TEST--
Bug #79710: Reproducible segfault in error_handler during GC involved an SplFileObject
--FILE--
<?php
class Target
{
public $sfo;
public function __construct($sfo) {
$this->sfo = $sfo;
}
public function __destruct() {
// If the SplFileObject is destructed first,
// underlying FD is no longer valid and will cause error upon calling flock
$this->sfo->flock(2);
}
}
class Run
{
static $sfo;
static $foo;
public static function main() {
// Creation ordering is important for repro
// $sfo needed to be destructed before $foo.
Run::$sfo = new SplTempFileObject();
Run::$foo = new Target(Run::$sfo);
}
}
Run::main();
?>
--EXPECTF--
Fatal error: Uncaught Error: Object not initialized in %s:%d
Stack trace:
#0 %s(%d): SplFileObject->flock(2)
#1 [internal function]: Target->__destruct()
#2 {main}
thrown in %s on line %d
Function Calls
None |
Stats
MD5 | b8088be6e6d44816300737a23a0ed789 |
Eval Count | 0 |
Decode Time | 82 ms |