Skip to content

Commit 571f67c

Browse files
committed
Merge branch 'PHP-8.4' into gh20837
2 parents b669704 + 60b1f59 commit 571f67c

6 files changed

Lines changed: 51 additions & 4 deletions

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ PHP NEWS
1313
- Standard:
1414
. Fixed bug #74357 (lchown fails to change ownership of symlink with ZTS)
1515
(Jakub Zelenka)
16+
. Fixed bug GH-20843 (var_dump() crash with nested objects)
17+
(David Carlier)
1618

1719
15 Jan 2026, PHP 8.4.17
1820

ext/sodium/libsodium.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@ PHP_FUNCTION(sodium_crypto_scalarmult)
26032603
RETURN_THROWS();
26042604
}
26052605
if (p_len != crypto_scalarmult_BYTES) {
2606-
zend_argument_error(sodium_exception_ce, 2, "must be SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes long");
2606+
zend_argument_error(sodium_exception_ce, 2, "must be SODIUM_CRYPTO_SCALARMULT_BYTES bytes long");
26072607
RETURN_THROWS();
26082608
}
26092609
q = zend_string_alloc(crypto_scalarmult_BYTES, 0);
@@ -2674,7 +2674,7 @@ PHP_FUNCTION(sodium_crypto_scalarmult_ristretto255_base)
26742674
zend_argument_error(sodium_exception_ce, 1, "must not be zero", 0);
26752675
RETURN_THROWS();
26762676
}
2677-
ZSTR_VAL(q)[crypto_scalarmult_BYTES] = 0;
2677+
ZSTR_VAL(q)[crypto_scalarmult_ristretto255_BYTES] = 0;
26782678

26792679
RETURN_NEW_STR(q);
26802680
}
@@ -3214,7 +3214,7 @@ PHP_FUNCTION(sodium_crypto_kdf_derive_from_key)
32143214
RETURN_THROWS();
32153215
}
32163216
if (key_len != crypto_kdf_KEYBYTES) {
3217-
zend_argument_error(sodium_exception_ce, 4, "must be SODIUM_CRYPTO_KDF_BYTES_MIN bytes long");
3217+
zend_argument_error(sodium_exception_ce, 4, "must be SODIUM_CRYPTO_KDF_KEYBYTES bytes long");
32183218
RETURN_THROWS();
32193219
}
32203220
memcpy(ctx_padded, ctx, crypto_kdf_CONTEXTBYTES);

ext/standard/tests/file/bug69442.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--TEST--
22
proc_open with PTY closes incorrect file descriptor
3+
--FLAKY--
34
--SKIPIF--
45
<?php
56

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
GH-20840 (var_dump() crash with nested objects)
3+
--CREDITS--
4+
bendrissou
5+
--SKIPIF--
6+
<?php
7+
if (ini_get('zend.max_allowed_stack_size') === false) {
8+
die('skip No stack limit support');
9+
}
10+
if (getenv('SKIP_ASAN')) {
11+
die('skip ASAN needs different stack limit setting due to more stack space usage');
12+
}
13+
?>
14+
--INI--
15+
zend.max_allowed_stack_size=512K
16+
--FILE--
17+
<?php
18+
class Node {
19+
public $next;
20+
}
21+
22+
$firstNode = new Node();
23+
$node = $firstNode;
24+
25+
for ($i = 0; $i < 50000; $i++) {
26+
$newNode = new Node();
27+
$node->next = $newNode;
28+
$node = $newNode;
29+
}
30+
31+
var_dump($firstNode);
32+
33+
while ($next = $firstNode->next) {
34+
$firstNode->next = $next->next;
35+
}
36+
?>
37+
--EXPECTREGEX--
38+
^object\(Node\)#\d+ \(\d+\).*(nesting level too deep|["\s}]*)$

ext/standard/var.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze
5656
{
5757
const char *prop_name, *class_name;
5858

59+
#ifdef ZEND_CHECK_STACK_LIMIT
60+
if (UNEXPECTED(zend_call_stack_overflowed(EG(stack_limit)))) {
61+
php_printf("%*cnesting level too deep", level + 1, ' ');
62+
return;
63+
}
64+
#endif
5965
if (key == NULL) { /* numeric key */
6066
php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
6167
} else { /* string key */

main/fastcgi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ static inline ssize_t safe_write(fcgi_request *req, const void *buf, size_t coun
944944
return n;
945945
}
946946

947-
static inline ssize_t safe_read(fcgi_request *req, const void *buf, size_t count)
947+
static inline ssize_t safe_read(fcgi_request *req, void *buf, size_t count)
948948
{
949949
int ret;
950950
size_t n = 0;

0 commit comments

Comments
 (0)