Skip to content

Commit 4643386

Browse files
Fix regression on platforms without ZEND_CHECK_STACK_LIMIT set (8.4) (#16285)
The check called an API only available with this def set. Gate the check behind ifdef and change control flow to better fit it. Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
1 parent d76ef13 commit 4643386

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/standard/var.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,10 +1036,12 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, HashTable *ht,
10361036
static zend_always_inline bool php_serialize_check_stack_limit(void)
10371037
{
10381038
#ifdef ZEND_CHECK_STACK_LIMIT
1039-
return zend_call_stack_overflowed(EG(stack_limit));
1040-
#else
1041-
return false;
1039+
if (UNEXPECTED(zend_call_stack_overflowed(EG(stack_limit)))) {
1040+
zend_call_stack_size_error();
1041+
return true;
1042+
}
10421043
#endif
1044+
return false;
10431045
}
10441046

10451047
static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_data_t var_hash, bool in_rcn_array, bool is_root) /* {{{ */
@@ -1052,7 +1054,6 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_
10521054
}
10531055

10541056
if (UNEXPECTED(php_serialize_check_stack_limit())) {
1055-
zend_call_stack_size_error();
10561057
return;
10571058
}
10581059

0 commit comments

Comments
 (0)