Description
Hello, I think I found some bugs here.
- take official docker image
- install opcache
- set opcache.ini config as:
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=100M
opcache.jit=1205
The following code:
<?phpdeclare(strict_types=1);
interface EntityManagerInterface {
publicfunctionpersist(object$entity);
}
class EntityManager implements EntityManagerInterface {
publicfunctionpersist(object$entity)
{
echo"Persisting entity: " . get_class($entity) . "\n";
}
}
abstractclass AbstractDecorator implements EntityManagerInterface {
protected$wrapped;
publicfunctionpersist(object$entity)
{
$this->wrapped->persist($entity);
}
}
class EntityManagerDecorator extends AbstractDecorator {
protectedobject$proxy;
protected$wrapped {
get {
if (!isset($this->proxy)) {
$this->proxy = ($this->factory)();
}
return$this->proxy;
}
}
publicfunction__construct(privateClosure$factory)
{
}
}
$em = newEntityManagerDecorator(staticfn() => newEntityManager());
$a = newstdClass();
$em->persist($a);
$a1 = newstdClass();
$em->persist($a1);Case 1: SEGMENTATION FAULT
If run this code, then it will be crash on
$em->persist($a1);
Case 2: Fatal error (unexpected behaviour)
If remove in this code interface EntityManagerInterface and implements statements then it will be give fatal error:
Fatal error: Uncaught Error: Call to a member function persist() on null in /app/test.php:20
Stack trace:
#0 /app/test.php(42): AbstractDecorator->persist(Object(stdClass))
#1 {main}
thrown in /app/test.php on line 20
If disable opcache or use tracing mode it will be work as expected:
Persisting entity: stdClass
Persisting entity: stdClass
P.S. I tried test PHP 8.4.3RC1 - bugs also exists there.
PHP Version
PHP 8.4.2
Operating System
Alpine 3.21
Description
Hello, I think I found some bugs here.
The following code:
Case 1: SEGMENTATION FAULT
If run this code, then it will be crash on
$em->persist($a1);Case 2: Fatal error (unexpected behaviour)
If remove in this code interface EntityManagerInterface and implements statements then it will be give fatal error:
If disable opcache or use tracing mode it will be work as expected:
P.S. I tried test PHP 8.4.3RC1 - bugs also exists there.
PHP Version
PHP 8.4.2
Operating System
Alpine 3.21