From 6288228b566db29637e041ffd6392d9895d4d223 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 20 Jan 2021 11:03:37 +0300 Subject: [PATCH] Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code) --- NEWS | 3 +++ ext/opcache/jit/zend_jit_x86.dasc | 5 ++++- ext/opcache/tests/jit/bug80634.phpt | 22 ++++++++++++++++++++++ ext/opcache/tests/jit/preload_bug80634.inc | 10 ++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/jit/bug80634.phpt create mode 100644 ext/opcache/tests/jit/preload_bug80634.inc diff --git a/NEWS b/NEWS index 06da4d05b86..95d96df80e4 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2021, PHP 8.0.3 +- Opcache: + . Fixed bug #80634 (write_property handler of internal classes is skipped on + preloaded JITted code). (Dmitry) 21 Jan 2021, PHP 8.0.2 diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 5ff3c050344..91038b1be42 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -12626,7 +12626,10 @@ static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, ze { zend_property_info *info = NULL; - if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) { + if (!ce || + !(ce->ce_flags & ZEND_ACC_LINKED) || + (ce->ce_flags & ZEND_ACC_TRAIT) || + ce->create_object) { return NULL; } diff --git a/ext/opcache/tests/jit/bug80634.phpt b/ext/opcache/tests/jit/bug80634.phpt new file mode 100644 index 00000000000..579adda0e35 --- /dev/null +++ b/ext/opcache/tests/jit/bug80634.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +opcache.protect_memory=1 +opcache.jit=function +opcache.preload={PWD}/preload_bug80634.inc +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught Error: Writing to DatePeriod->interval is unsupported in %spreload_bug80634.inc:7 +Stack trace: +#0 %sbug80634.php(2): SomeClass->__construct(5) +#1 {main} + thrown in %spreload_bug80634.inc on line 7 \ No newline at end of file diff --git a/ext/opcache/tests/jit/preload_bug80634.inc b/ext/opcache/tests/jit/preload_bug80634.inc new file mode 100644 index 00000000000..feee9ec9706 --- /dev/null +++ b/ext/opcache/tests/jit/preload_bug80634.inc @@ -0,0 +1,10 @@ +interval = $v; + var_dump($this->interval); + } +} \ No newline at end of file