Skip to content

Commit 28a30f7

Browse files
committed
Handle static return type in AST printer
Fixes OSS-Fuzz #20782.
1 parent 736b22d commit 28a30f7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Zend/tests/assert/expect_015.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ assert(0 && ($a = function &(array &...$a) {
119119
}
120120
}));
121121

122-
assert(0 && ($a = function () {
122+
assert(0 && ($a = function (): ?static {
123123
declare(C=1) { echo 1; }
124124
$x = '\'"`$a';
125125
$x = "'\"`$a";
@@ -160,7 +160,7 @@ Warning: assert(): assert(0 && ($a = function () {
160160
$y = clone $x;
161161
yield 1 => 2;
162162
yield from $x;
163-
})) failed in %sexpect_015.php on line %d
163+
})) failed in %s on line %d
164164

165165
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
166166
abstract class A extends B implements C, D {
@@ -202,7 +202,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c,
202202

203203
}
204204

205-
})) failed in %sexpect_015.php on line %d
205+
})) failed in %s on line %d
206206

207207
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
208208
final class A {
@@ -242,7 +242,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null, int|floa
242242

243243
}
244244

245-
})) failed in %sexpect_015.php on line %d
245+
})) failed in %s on line %d
246246

247247
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
248248
class A {
@@ -255,7 +255,7 @@ Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c,
255255
use T3;
256256
}
257257

258-
})) failed in %sexpect_015.php on line %d
258+
})) failed in %s on line %d
259259

260260
Warning: assert(): assert(0 && ($a = function &(array &...$a) {
261261
declare(A = 1, B = 2);
@@ -268,9 +268,9 @@ Warning: assert(): assert(0 && ($a = function &(array &...$a) {
268268
} finally {
269269
echo 3;
270270
}
271-
})) failed in %sexpect_015.php on line %d
271+
})) failed in %s on line %d
272272

273-
Warning: assert(): assert(0 && ($a = function () {
273+
Warning: assert(): assert(0 && ($a = function (): ?static {
274274
declare(C = 1) {
275275
echo 1;
276276
}
@@ -296,4 +296,4 @@ Warning: assert(): assert(0 && ($a = function () {
296296
if ($a) {
297297
} else {
298298
}
299-
})) failed in %sexpect_015.php on line %d
299+
})) failed in %s on line %d

Zend/zend_ast.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
15711571
switch (ast->attr & ~ZEND_TYPE_NULLABLE) {
15721572
case IS_ARRAY: APPEND_STR("array");
15731573
case IS_CALLABLE: APPEND_STR("callable");
1574+
case IS_STATIC: APPEND_STR("static");
15741575
EMPTY_SWITCH_DEFAULT_CASE();
15751576
}
15761577
break;

0 commit comments

Comments
 (0)