Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -17291,16 +17291,8 @@ static int zend_jit_trace_return(zend_jit_ctx *jit, bool original_handler, const
addr = ir_CAST_FC_FUNC(addr);
#endif
ref = ir_CALL_2(IR_ADDR, addr, jit_FP(jit), jit_IP(jit));
if (opline &&
(opline->opcode == ZEND_RETURN
|| opline->opcode == ZEND_RETURN_BY_REF
|| opline->opcode == ZEND_GENERATOR_RETURN
|| opline->opcode == ZEND_GENERATOR_CREATE
|| opline->opcode == ZEND_YIELD
|| opline->opcode == ZEND_YIELD_FROM)) {
zend_jit_vm_enter(jit, ref);
return 1;
}
zend_jit_vm_enter(jit, ref);
return 1;
}
zend_jit_vm_enter(jit, jit_IP(jit));
}
Expand Down
42 changes: 42 additions & 0 deletions ext/opcache/tests/jit/gh19486.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--TEST--
GH-19486: incorrect opline after deoptimization
--INI--
opcache.jit_blacklist_root_trace=1
opcache.jit_blacklist_side_trace=1
--FILE--
<?php

(new GameMap())->getLakeArea(0, 0);

class GameMap
{
public $lakeID = [];

public function getLakeArea(int $x, int $y): int
{
$this->floodFill(0, 0, 0);
}

public function floodFill(int $x, int $y, int $id): void
{
if (($x < 0) or ($x >= 50) or ($y < 0) or ($y >= 50)) {
return;
}
if (isset($this->lakeID[$y][$x]) and ($this->lakeID[$y][$x] == $id)) {
return;
}
$this->lakeID[$y][$x] = $id;
$this->floodFill($x - 1, $y, $id);
$this->floodFill($x + 1, $y, $id);
$this->floodFill($x, $y - 1, $id);
$this->floodFill($x, $y + 1, $id);
}
}

?>
--EXPECTF--
Fatal error: Uncaught TypeError: GameMap::getLakeArea(): Return value must be of type int, none returned in %s:%d
Stack trace:
#0 %s(%d): GameMap->getLakeArea(0, 0)
#1 {main}
thrown in %s on line %d