Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2428,9 +2428,22 @@ static zend_class_entry* zend_accel_inheritance_cache_add(zend_class_entry *ce,
} ZEND_HASH_FOREACH_END();
ZCG(mem) = (char*)ZCG(mem) + zend_hash_num_elements(dependencies) * sizeof(zend_class_dependency);
}

/* See GH-15657: `zend_persist_class_entry` can JIT property hook code via
* `zend_persist_property_info`, but the inheritance cache should not
* JIT those at this point in time. */
#ifdef HAVE_JIT
bool jit_on_old = JIT_G(on);
JIT_G(on) = false;
#endif

entry->ce = new_ce = zend_persist_class_entry(ce);
zend_update_parent_ce(new_ce);

#ifdef HAVE_JIT
JIT_G(on) = jit_on_old;
#endif

entry->num_warnings = EG(num_errors);
entry->warnings = zend_persist_warnings(EG(num_errors), EG(errors));
entry->next = proto->inheritance_cache;
Expand Down
22 changes: 22 additions & 0 deletions ext/opcache/tests/jit/gh15657.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GH-15657 (Segmentation fault in ext/opcache/jit/ir/dynasm/dasm_x86.h)
--EXTENSIONS--
opcache
--INI--
opcache.jit_buffer_size=64M
opcache.jit=1101
--FILE--
<?php
// Triggering the inheritance cache via implementing this interface is important to reproduce the bug
interface I {}

class A implements I {
private $_prop;
public $prop {
get => $this->_prop;
}
}
echo "Done\n";
?>
--EXPECT--
Done
Loading