Skip to content

Commit

Permalink
Fixed bug #80634 (write_property handler of internal classes is skipp…
Browse files Browse the repository at this point in the history
…ed on preloaded JITted code)
  • Loading branch information
dstogov committed Jan 20, 2021
1 parent 34f0f60 commit 6288228
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
22 changes: 22 additions & 0 deletions ext/opcache/tests/jit/bug80634.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$v = new SomeClass(5);
?>
--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
10 changes: 10 additions & 0 deletions ext/opcache/tests/jit/preload_bug80634.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
class SomeClass extends \DatePeriod {
public $interval;

public function __construct(int $v) {
parent::__construct(new \DateTime('2020-12-31'), new \DateInterval("P1Y"), 1);
$this->interval = $v;
var_dump($this->interval);
}
}

0 comments on commit 6288228

Please sign in to comment.