mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-15101: _ir_RSTORE: Assertion `ctx->control' (#15153)
This commit is contained in:
@@ -8180,6 +8180,8 @@ static int zend_jit_type_check(zend_jit_ctx *jit, const zend_op *opline, uint32_
|
||||
if (!smart_branch_opcode || exit_addr) {
|
||||
if (end_inputs) {
|
||||
ir_MERGE_list(end_inputs);
|
||||
} else if (exit_addr && !jit->ctx.control) {
|
||||
ir_BEGIN(IR_UNUSED); /* unreachable block */
|
||||
}
|
||||
} else {
|
||||
_zend_jit_merge_smart_branch_inputs(jit, true_label, false_label, true_inputs, false_inputs);
|
||||
|
||||
77
ext/opcache/tests/jit/gh15101.phpt
Normal file
77
ext/opcache/tests/jit/gh15101.phpt
Normal file
@@ -0,0 +1,77 @@
|
||||
--TEST--
|
||||
GH-15101: _ir_RSTORE: Assertion `ctx->control' failed
|
||||
--EXTENSIONS--
|
||||
opcache
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.revalidate_freq=0
|
||||
opcache.protect_memory=1
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
function test($context, $token) {
|
||||
if ($token instanceof DoctypeToken) {
|
||||
$this->processDoctypeToken($context, $token);
|
||||
}
|
||||
}
|
||||
private function processDoctypeToken(TreeBuilderContext $context, DoctypeToken $token): void
|
||||
{
|
||||
$publicId = $token->publicIdentifier;
|
||||
$systemId = $token->systemIdentifier;
|
||||
$name = $token->name;
|
||||
|
||||
if ($name !== 'html'
|
||||
|| $publicId !== null
|
||||
|| ($systemId !== null && $systemId !== 'about:legacy-compat')) {
|
||||
}
|
||||
|
||||
$doctype = new DocumentType($context->document, $name ?? '', $publicId ?? '', $systemId ?? '');
|
||||
}
|
||||
}
|
||||
class Document {
|
||||
}
|
||||
final class TreeBuilderContext {
|
||||
public $document;
|
||||
public function __construct() {
|
||||
$this->document = new Document;
|
||||
}
|
||||
}
|
||||
abstract class Node {
|
||||
public const DOCUMENT_TYPE_NODE = 10;
|
||||
|
||||
protected function __construct(Document $document, int $nodeType)
|
||||
{
|
||||
}
|
||||
}
|
||||
class DocumentType extends Node {
|
||||
public readonly string $name;
|
||||
public readonly string $publicId;
|
||||
public readonly string $systemId;
|
||||
|
||||
public function __construct(
|
||||
Document $document,
|
||||
string $name,
|
||||
string $publicId = '',
|
||||
string $systemId = '') {
|
||||
parent::__construct($document, self::DOCUMENT_TYPE_NODE);
|
||||
}
|
||||
}
|
||||
class DoctypeToken {
|
||||
public $publicIdentifier;
|
||||
public $name;
|
||||
public $systemIdentifier;
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$doc = new TreeBuilderContext();
|
||||
$t = new DoctypeToken();
|
||||
$t->name = "html";
|
||||
foreach ([$doc, $t] as $token) {
|
||||
$a->test($doc, $token);
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
Reference in New Issue
Block a user