Skip to content

Commit 378f870

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code)
2 parents d8c785b + 6288228 commit 378f870

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12607,7 +12607,10 @@ static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, ze
1260712607
{
1260812608
zend_property_info *info = NULL;
1260912609

12610-
if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) {
12610+
if (!ce ||
12611+
!(ce->ce_flags & ZEND_ACC_LINKED) ||
12612+
(ce->ce_flags & ZEND_ACC_TRAIT) ||
12613+
ce->create_object) {
1261112614
return NULL;
1261212615
}
1261312616

ext/opcache/tests/jit/bug80634.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
opcache.jit=function
10+
opcache.preload={PWD}/preload_bug80634.inc
11+
--SKIPIF--
12+
<?php require_once('skipif.inc'); ?>
13+
--FILE--
14+
<?php
15+
$v = new SomeClass(5);
16+
?>
17+
--EXPECTF--
18+
Fatal error: Uncaught Error: Writing to DatePeriod->interval is unsupported in %spreload_bug80634.inc:7
19+
Stack trace:
20+
#0 %sbug80634.php(2): SomeClass->__construct(5)
21+
#1 {main}
22+
thrown in %spreload_bug80634.inc on line 7
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
class SomeClass extends \DatePeriod {
3+
public $interval;
4+
5+
public function __construct(int $v) {
6+
parent::__construct(new \DateTime('2020-12-31'), new \DateInterval("P1Y"), 1);
7+
$this->interval = $v;
8+
var_dump($this->interval);
9+
}
10+
}

0 commit comments

Comments
 (0)