Open ziaratban opened 2 years ago
Other behavior : edit c.php
$r = new \parallel\Runtime();
$r->run(static function(){
substr('',''); // <--- added
require 'b.php';
t();
});
output :
Fatal error: Uncaught TypeError: substr(): Argument #2 ($offset) must be of type int, string given in /root/b.php:3
Stack trace:
#0 /root/b.php(3): substr('', '')
#1 /root/c.php(6): t()
#2 {main}
thrown in /root/b.php on line 3
edit b.php
$r = new \parallel\Runtime();
$r->run(static function(){
opcache_invalidate('b.php'); // <--- added
require 'b.php';
t();
});
Hey @ziaratban,
sorry for radio silence. First of all: thanks for this nice and easy reproducer!
I gave it a quick try and was able to reproduce this with OPcache, but not without OPcache.
I am pretty new to parallel
, but I am not sure if require
/include
are actually supported, another way to fix this is to include b.php
not using require
/include
, but using the bootstrap mechanism in b.php
like this:
<?php
$r = new \parallel\Runtime('b.php');
$r->run(static function(){
t();
});
This fixes it at leas for me on:
$ php -v
PHP 8.3.11-dev (cli) (built: Jul 23 2024 20:50:22) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.3.11-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.3.11-dev, Copyright (c), by Zend Technologies
Hi
a.php
b.php
c.php