Skip to content

Commit 249f7df

Browse files
committed
Merge branch 'PHP-7.3'
* PHP-7.3: Update NEWS Fixed bug #77660 (Segmentation fault on break 2147483648)
2 parents c599c18 + fb3f078 commit 249f7df

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Zend/tests/bug77660.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #77660 (Segmentation fault on break 2147483648)
3+
--SKIPIF--
4+
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
5+
--FILE--
6+
<?php
7+
for(;;) break 2147483648;
8+
?>
9+
--EXPECTF--
10+
Fatal error: Cannot 'break' 2147483648 levels in %sbug77660.php on line %d

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4272,7 +4272,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
42724272
zend_ast *depth_ast = ast->child[0];
42734273

42744274
zend_op *opline;
4275-
int depth;
4275+
zend_long depth;
42764276

42774277
ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE);
42784278

@@ -4299,7 +4299,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
42994299
ast->kind == ZEND_AST_BREAK ? "break" : "continue");
43004300
} else {
43014301
if (!zend_handle_loops_and_finally_ex(depth, NULL)) {
4302-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' %d level%s",
4302+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' " ZEND_LONG_FMT " level%s",
43034303
ast->kind == ZEND_AST_BREAK ? "break" : "continue",
43044304
depth, depth == 1 ? "" : "s");
43054305
}

0 commit comments

Comments
 (0)