Skip to content

Commit 6288228

Browse files
committed
Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code)
1 parent 34f0f60 commit 6288228

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2021, PHP 8.0.3
44

5+
- Opcache:
6+
. Fixed bug #80634 (write_property handler of internal classes is skipped on
7+
preloaded JITted code). (Dmitry)
58

69
21 Jan 2021, PHP 8.0.2
710

ext/opcache/jit/zend_jit_x86.dasc

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

12629-
if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) {
12629+
if (!ce ||
12630+
!(ce->ce_flags & ZEND_ACC_LINKED) ||
12631+
(ce->ce_flags & ZEND_ACC_TRAIT) ||
12632+
ce->create_object) {
1263012633
return NULL;
1263112634
}
1263212635

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)