aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Execution/Runtime.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-05-01 23:17:58 +0900
committernsfisis <nsfisis@gmail.com>2024-05-01 23:17:58 +0900
commitabdad356462b4b84cba771af742d1b6ecfaabc2d (patch)
tree40a763ad15af318cfcbc00515a32d3c0970f0df2 /src/Execution/Runtime.php
parentbd72d3c4acde3f5e79bd494d4678a6e72e92e313 (diff)
downloadphp-waddiwasi-abdad356462b4b84cba771af742d1b6ecfaabc2d.tar.gz
php-waddiwasi-abdad356462b4b84cba771af742d1b6ecfaabc2d.tar.zst
php-waddiwasi-abdad356462b4b84cba771af742d1b6ecfaabc2d.zip
test: define more trap kind
Diffstat (limited to 'src/Execution/Runtime.php')
-rw-r--r--src/Execution/Runtime.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php
index 9d7c367..08600e5 100644
--- a/src/Execution/Runtime.php
+++ b/src/Execution/Runtime.php
@@ -1756,7 +1756,7 @@ final class Runtime
$s = $this->stack->popInt();
$d = $this->stack->popInt();
if (count($tabX->elem) < $d + $n || count($tabY->elem) < $s + $n) {
- throw new TrapException("table.copy: out of bounds");
+ throw new TrapException("table.copy: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
if ($n === 0 || ($x === $y && $d === $s)) {
return;
@@ -1779,7 +1779,7 @@ final class Runtime
$val = $this->stack->popRef();
$i = $this->stack->popInt();
if (count($tab->elem) < $i + $n) {
- throw new TrapException("table.fill: out of bounds");
+ throw new TrapException("table.fill: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
for ($k = 0; $k < $n; $k++) {
// @phpstan-ignore-next-line
@@ -1795,7 +1795,7 @@ final class Runtime
$tab = $this->store->tables[$a];
$i = $this->stack->popInt();
if (count($tab->elem) <= $i) {
- throw new TrapException("table.get: out of bounds");
+ throw new TrapException("table.get: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
$val = $tab->elem[$i];
$this->stack->pushValue($val);
@@ -1845,10 +1845,10 @@ final class Runtime
$s = $this->stack->popInt();
$d = $this->stack->popInt();
if (count($elem->elem) < $s + $n) {
- throw new TrapException("table.init: out of bounds");
+ throw new TrapException("table.init: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
if (count($tab->elem) < $d + $n) {
- throw new TrapException("table.init: out of bounds");
+ throw new TrapException("table.init: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
for ($i = 0; $i < $n; $i++) {
// @phpstan-ignore-next-line
@@ -1865,7 +1865,7 @@ final class Runtime
$val = $this->stack->popRef();
$i = $this->stack->popInt();
if (count($tab->elem) <= $i) {
- throw new TrapException("table.set: out of bounds");
+ throw new TrapException("table.set: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess);
}
// @phpstan-ignore-next-line
$tab->elem[$i] = $val;