1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/Zend/tests/stack_limit/stack_limit_015.phpt
Ilija Tovilo 6173a9a109 VAR|TMP overhaul (GH-20628)
The aim of this PR is twofold:

- Reduce the number of highly similar TMP|VAR handlers
- Avoid ZVAL_DEREF in most of these cases

This is achieved by guaranteeing that all zend_compile_expr() calls, as well as
all other compile calls with BP_VAR_{R,IS}, will result in a TMP variable. This
implies that the result will not contain an IS_INDIRECT or IS_REFERENCE value,
which was mostly already the case, with two exceptions:

- Calls to return-by-reference functions. Because return-by-reference functions
  are quite rare, this is solved by delegating the DEREF to the RETURN_BY_REF
  handler, which will examine the stack to check whether the caller expects a
  VAR or TMP to understand whether the DEREF is needed. Internal functions will
  also need to adjust by calling the zend_return_unwrap_ref() function.

- By-reference assignments, including both $a = &$b, as well as $a = [&$b]. When
  the result of these expressions is used in a BP_VAR_R context, the reference
  is unwrapped via a ZEND_QM_ASSIGN opcode beforehand. This is exceptionally
  rare.

Closes GH-20628
2026-01-31 19:44:56 +01:00

72 lines
2.2 KiB
PHP

--TEST--
Stack limit 015 - Internal stack limit check in zend_compile_var()
--CREDITS--
abdullahasif88
--SKIPIF--
<?php
if (!function_exists('zend_test_zend_call_stack_get')) die("skip zend_test_zend_call_stack_get() is not available");
?>
--EXTENSIONS--
zend_test
--INI--
zend.max_allowed_stack_size=64K
--FILE--
<?php
$test
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
->p->p->p->p->p->p->p->p->p->p
;
?>
--EXPECTF--
Fatal error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached during compilation. Try splitting expression in %s on line %d