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-- GH-12380: JIT+private array property access inside closure accesses private prope..

Decoded Output download

--TEST--
GH-12380: JIT+private array property access inside closure accesses private property in child class
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
opcache.jit=tracing
opcache.jit_hot_loop=1
opcache.jit_hot_func=1
opcache.jit_hot_return=1
opcache.jit_hot_side_exit=1
--EXTENSIONS--
opcache
--FILE--
<?php

abstract class a
{
    private int $v = 1;

    public function test(): void
    {
        var_dump($this->v);
        (function (): void {
            var_dump($this->v);
        })();
    }
}

final class b extends a {
    private int $v = 0;
}
$a = new b;

for ($i = 0; $i < 10; $i++) {
    $a->test();
}

?>
--EXPECT--
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)

Did this file decode correctly?

Original Code

--TEST--
GH-12380: JIT+private array property access inside closure accesses private property in child class
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
opcache.jit=tracing
opcache.jit_hot_loop=1
opcache.jit_hot_func=1
opcache.jit_hot_return=1
opcache.jit_hot_side_exit=1
--EXTENSIONS--
opcache
--FILE--
<?php

abstract class a
{
    private int $v = 1;

    public function test(): void
    {
        var_dump($this->v);
        (function (): void {
            var_dump($this->v);
        })();
    }
}

final class b extends a {
    private int $v = 0;
}
$a = new b;

for ($i = 0; $i < 10; $i++) {
    $a->test();
}

?>
--EXPECT--
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)
int(1)

Function Calls

None

Variables

None

Stats

MD5 f53c47f5346c36bd4bb5cc373e040d07
Eval Count 0
Decode Time 87 ms