Bug #80634 [NEW]: write_property handler of internal classes is skipped on preloaded JITted code

From: Date: Fri, 15 Jan 2021 23:13:39 +0000
Subject: Bug #80634 [NEW]: write_property handler of internal classes is skipped on preloaded JITted code
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231591@lists.php.net to get a copy of this message
From:             dktapps at pmmp dot io
Operating system: Linux
PHP version:      8.0.1
Package:          JIT
Bug Type:         Bug
Bug description:write_property handler of internal classes is skipped on preloaded JITted code

Description:
------------
When a class which extends an internal class is preloaded and
JIT-compiled, the internal class' write_property handler doesn't get
executed. Without preloading it works correctly.

This requires quite an exotic test case to reproduce. While the test
case itself doesn't make any sense, it's a case that I've encountered
while updating an extension with real code, and I spent some time to
create a reproducing test case only using PHP's own builtin classes to
ensure that it wasn't some crazy bug in my extension.

Command line is `php -dopcache.enable_cli=1 -dopcache.jit=1205
-dopcache.preload=preload.php test.php`



Test script:
---------------
preload.php:
<?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);
	}
}

test.php:
<?php

$v = new SomeClass(5);

Expected result:
----------------
(this output is produced without preloading or JIT)

PHP Fatal error:  Uncaught Error: Writing to DatePeriod->interval is
unsupported in /home/user/pocketmine-mp/preload.php:8
Stack trace:
#0 /home/user/pocketmine-mp/test.php(3): SomeClass->__construct()
#1 {main}
  thrown in /home/user/pocketmine-mp/preload.php on line 8



Actual result:
--------------
int(5)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80634&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80634&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80634&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80634&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80634&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80634&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80634&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80634&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80634&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80634&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80634&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80634&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80634&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80634&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80634&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80634&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80634&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80634&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#231591) next »