-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.4: Fix GH-17307: Internal closure causes JIT failure Generate inline frameless icall handlers only if the optimization level is set to inline Fix GH-15981: Segfault with frameless jumps and minimal JIT Fix GH-15833: Segmentation fault (access null pointer) in ext/spl/spl_array.c
- Loading branch information
Showing
7 changed files
with
175 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
GH-15981 (Segfault with frameless jumps and minimal JIT) | ||
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.jit=1111 | ||
--FILE-- | ||
<?php | ||
|
||
namespace NS { // Namespace is important to reproduce the issue | ||
class Tester { | ||
static public function findExecutable(): string { | ||
return dirname(__DIR__); | ||
} | ||
} | ||
} | ||
|
||
namespace { | ||
var_dump(NS\Tester::findExecutable()); | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
string(%d) "%s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--TEST-- | ||
GH-17307 (Internal closure causes JIT failure) | ||
--EXTENSIONS-- | ||
opcache | ||
simplexml | ||
bcmath | ||
--INI-- | ||
opcache.jit=1254 | ||
opcache.jit_hot_func=1 | ||
opcache.jit_buffer_size=32M | ||
--FILE-- | ||
<?php | ||
|
||
$simple = new SimpleXMLElement("<root><a/><b/></root>"); | ||
|
||
function run_loop($firstTerms, $closure) { | ||
foreach ($firstTerms as $firstTerm) { | ||
\debug_zval_dump($firstTerm); | ||
$closure($firstTerm, "10"); | ||
} | ||
} | ||
|
||
run_loop($simple, bcadd(...)); | ||
echo "Done\n"; | ||
|
||
?> | ||
--EXPECTF-- | ||
object(SimpleXMLElement)#%d (0) refcount(3){ | ||
} | ||
object(SimpleXMLElement)#%d (0) refcount(3){ | ||
} | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
GH-15833 (Segmentation fault (access null pointer) in ext/spl/spl_array.c) | ||
--CREDITS-- | ||
YuanchengJiang | ||
--FILE-- | ||
<?php | ||
class C { | ||
public int $a = 1; | ||
} | ||
$reflector = new ReflectionClass(C::class); | ||
$obj = $reflector->newLazyProxy(function ($obj) { | ||
$obj = new C(); | ||
return $obj; | ||
}); | ||
$recursiveArrayIterator = new RecursiveArrayIterator($obj); | ||
var_dump($recursiveArrayIterator->current()); | ||
$recursiveArrayIterator->next(); | ||
var_dump($recursiveArrayIterator->current()); | ||
?> | ||
--EXPECT-- | ||
int(1) | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--TEST-- | ||
GH-15833 (Segmentation fault (access null pointer) in ext/spl/spl_array.c) | ||
--CREDITS-- | ||
YuanchengJiang | ||
--FILE-- | ||
<?php | ||
class C { | ||
public int $a = 1; | ||
} | ||
$reflector = new ReflectionClass(C::class); | ||
$obj = $reflector->newLazyProxy(function ($obj) { | ||
static $counter = 0; | ||
throw new Error('nope ' . ($counter++)); | ||
}); | ||
$recursiveArrayIterator = new RecursiveArrayIterator($obj); | ||
try { | ||
var_dump($recursiveArrayIterator->current()); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
try { | ||
var_dump($recursiveArrayIterator->current()); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
try { | ||
$recursiveArrayIterator->next(); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
try { | ||
var_dump($recursiveArrayIterator->current()); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
nope 0 | ||
nope 1 | ||
nope 2 | ||
nope 3 |