Skip to content

Commit 14650f1

Browse files
committed
Merge tag 'php-8.3.10' into was-8.3.x
Tag for php-8.3.10
2 parents 66af8df + ace55c8 commit 14650f1

File tree

88 files changed

+979
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+979
-160
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ jobs:
445445
# Test causes a heap-buffer-overflow but I cannot reproduce it locally...
446446
php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
447447
# Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
448-
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
448+
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("public function testCastNonTrailingCharPointer()", "/** @group skip */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
449449
export ASAN_OPTIONS=exitcode=139
450450
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
451451
X=0

NEWS

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,82 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3-
04 Jul 2024, PHP 8.3.9
3+
01 Aug 2024, PHP 8.3.10
4+
5+
- Core:
6+
. Fixed bug GH-13922 (Fixed support for systems with
7+
sysconf(_SC_GETPW_R_SIZE_MAX) == -1). (Arnaud)
8+
. Fixed bug GH-14626 (Fix is_zend_ptr() for huge blocks). (Arnaud)
9+
. Fixed bug GH-14590 (Memory leak in FPM test gh13563-conf-bool-env.phpt.
10+
(nielsdos)
11+
. Fixed OSS-Fuzz #69765. (nielsdos)
12+
. Fixed bug GH-14741 (Segmentation fault in Zend/zend_types.h). (nielsdos)
13+
. Fixed bug GH-14969 (Use-after-free in property coercion with __toString()).
14+
(ilutov)
15+
16+
- Dom:
17+
. Fixed bug GH-14702 (DOMDocument::xinclude() crash). (nielsdos)
18+
19+
- Fileinfo:
20+
. Fixed bug GH-14888 (README.REDIST.BINS refers to non-existing LICENSE).
21+
(cmb)
22+
23+
- Gd:
24+
. ext/gd/tests/gh10614.phpt: skip if no PNG support. (orlitzky)
25+
. restored warning instead of fata error. (dryabov)
26+
27+
- LibXML:
28+
. Fixed bug GH-14563 (Build failure with libxml2 v2.13.0). (nielsdos)
29+
30+
- Opcache:
31+
. Fixed bug GH-14550 (No warning message when Zend DTrace is enabled that
32+
opcache.jit is implictly disabled). (nielsdos)
33+
34+
- Output:
35+
. Fixed bug GH-14808 (Unexpected null pointer in Zend/zend_string.h with
36+
empty output buffer). (nielsdos)
37+
38+
- PDO:
39+
. Fixed bug GH-14712 (Crash with PDORow access to null property).
40+
(David Carlier)
41+
42+
- Phar:
43+
. Fixed bug GH-14603 (null string from zip entry).
44+
(David Carlier)
45+
46+
- PHPDBG:
47+
. Fixed bug GH-14596 (crashes with ASAN and ZEND_RC_DEBUG=1).
48+
(David Carlier)
49+
. Fixed bug GH-14553 (echo output trimmed at NULL byte). (nielsdos)
50+
51+
- Shmop:
52+
. Fixed bug GH-14537 (shmop Windows 11 crashes the process). (nielsdos)
53+
54+
- SPL:
55+
. Fixed bug GH-14639 (Member access within null pointer in
56+
ext/spl/spl_observer.c). (nielsdos)
57+
58+
- Standard:
59+
. Fixed bug GH-14775 (range function overflow with negative step argument).
60+
(David Carlier)
61+
. Fix 32-bit wordwrap test failures. (orlitzky)
62+
. Fixed bug GH-14774 (time_sleep_until overflow). (David Carlier)
63+
64+
- Streams:
65+
. Fixed bug GH-14930 (Custom stream wrapper dir_readdir output truncated to
66+
255 characters in PHP 8.3). (Joe Cai)
67+
68+
- Tidy:
69+
. Fix memory leak in tidy_repair_file(). (nielsdos)
70+
71+
- Treewide:
72+
. Fix compatibility with libxml2 2.13.2. (nielsdos)
73+
74+
- XML:
75+
. Move away from to-be-deprecated libxml fields. (nielsdos)
76+
. Fixed bug GH-14834 (Error installing PHP when --with-pear is used).
77+
(nielsdos)
78+
79+
20 Jun 2024, PHP 8.3.9
480

581
- Core:
682
. Fixed bug GH-14315 (Incompatible pointer type warnings). (Peter Kokot)
@@ -15,7 +91,7 @@ PHP NEWS
1591
. Fixed bug GH-14549 (Incompatible function pointer type for fclose).
1692
(Ryan Carsten Schmidt)
1793

18-
- BCMatch:
94+
- BCMath:
1995
. Fixed bug (bcpowmod() with mod = -1 returns 1 when it must be 0). (Girgias)
2096

2197
- Curl:

TSRM/tsrm_win32.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
709709
CloseHandle(shm->segment);
710710
}
711711
UnmapViewOfFile(shm->descriptor);
712+
shm->descriptor = NULL;
712713
return -1;
713714
}
714715

@@ -744,8 +745,8 @@ TSRM_API int shmdt(const void *shmaddr)
744745
shm->descriptor->shm_lpid = getpid();
745746
shm->descriptor->shm_nattch--;
746747

747-
ret = 1;
748-
if (!ret && shm->descriptor->shm_nattch <= 0) {
748+
ret = 0;
749+
if (shm->descriptor->shm_nattch <= 0) {
749750
ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1;
750751
shm->descriptor = NULL;
751752
}

Zend/tests/gh14626.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-14626: is_zend_ptr() may crash for non-zend ptrs when huge blocks exist
3+
--EXTENSIONS--
4+
zend_test
5+
--FILE--
6+
<?php
7+
8+
// Ensure there is at least one huge_block
9+
$str = str_repeat('a', 2*1024*1024);
10+
11+
// Check that is_zend_ptr() does not crash
12+
zend_test_is_zend_ptr(0);
13+
zend_test_is_zend_ptr(1<<30);
14+
15+
?>
16+
==DONE==
17+
--EXPECT--
18+
==DONE==

Zend/tests/gh14969.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
GH-14969: Crash on coercion with throwing __toString()
3+
--FILE--
4+
<?php
5+
6+
class C {
7+
public function __toString() {
8+
global $c;
9+
$c = [];
10+
throw new Exception(__METHOD__);
11+
}
12+
}
13+
14+
class D {
15+
public string $prop;
16+
}
17+
18+
$c = new C();
19+
$d = new D();
20+
try {
21+
$d->prop = $c;
22+
} catch (Throwable $e) {
23+
echo $e->getMessage(), "\n";
24+
}
25+
var_dump($d);
26+
27+
$c = new C();
28+
$d->prop = 'foo';
29+
try {
30+
$d->prop = $c;
31+
} catch (Throwable $e) {
32+
echo $e->getMessage(), "\n";
33+
}
34+
var_dump($d);
35+
36+
?>
37+
--EXPECTF--
38+
C::__toString
39+
object(D)#%d (0) {
40+
["prop"]=>
41+
uninitialized(string)
42+
}
43+
C::__toString
44+
object(D)#2 (1) {
45+
["prop"]=>
46+
string(3) "foo"
47+
}

Zend/tests/oss-fuzz-69765.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
OSS-Fuzz #69765: yield reference to nullsafe chain
3+
--FILE--
4+
<?php
5+
function &test($object) {
6+
yield $object->y?->y;
7+
}
8+
?>
9+
--EXPECTF--
10+
Fatal error: Cannot take reference of a nullsafe chain in %s on line %d

Zend/zend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef ZEND_H
2121
#define ZEND_H
2222

23-
#define ZEND_VERSION "4.3.9"
23+
#define ZEND_VERSION "4.3.10"
2424

2525
#define ZEND_ENGINE_3
2626

Zend/zend_alloc.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,17 +2484,15 @@ ZEND_API bool is_zend_ptr(const void *ptr)
24842484
} while (chunk != AG(mm_heap)->main_chunk);
24852485
}
24862486

2487-
if (AG(mm_heap)->huge_list) {
2488-
zend_mm_huge_list *block = AG(mm_heap)->huge_list;
2489-
2490-
do {
2491-
if (ptr >= (void*)block
2492-
&& ptr < (void*)((char*)block + block->size)) {
2493-
return 1;
2494-
}
2495-
block = block->next;
2496-
} while (block != AG(mm_heap)->huge_list);
2487+
zend_mm_huge_list *block = AG(mm_heap)->huge_list;
2488+
while (block) {
2489+
if (ptr >= (void*)block
2490+
&& ptr < (void*)((char*)block + block->size)) {
2491+
return 1;
2492+
}
2493+
block = block->next;
24972494
}
2495+
24982496
return 0;
24992497
}
25002498

Zend/zend_compile.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,13 @@ static bool zend_ast_is_short_circuited(const zend_ast *ast)
24382438
}
24392439
}
24402440

2441+
static void zend_assert_not_short_circuited(const zend_ast *ast)
2442+
{
2443+
if (zend_ast_is_short_circuited(ast)) {
2444+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot take reference of a nullsafe chain");
2445+
}
2446+
}
2447+
24412448
/* Mark nodes that are an inner part of a short-circuiting chain.
24422449
* We should not perform a "commit" on them, as it will be performed by the outer-most node.
24432450
* We do this to avoid passing down an argument in various compile functions. */
@@ -3426,9 +3433,8 @@ static void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
34263433
if (!zend_is_variable_or_call(expr_ast)) {
34273434
zend_error_noreturn(E_COMPILE_ERROR,
34283435
"Cannot assign reference to non referenceable value");
3429-
} else if (zend_ast_is_short_circuited(expr_ast)) {
3430-
zend_error_noreturn(E_COMPILE_ERROR,
3431-
"Cannot take reference of a nullsafe chain");
3436+
} else {
3437+
zend_assert_not_short_circuited(expr_ast);
34323438
}
34333439

34343440
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);
@@ -3470,9 +3476,7 @@ static void zend_compile_assign_ref(znode *result, zend_ast *ast) /* {{{ */
34703476
zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
34713477
}
34723478
zend_ensure_writable_variable(target_ast);
3473-
if (zend_ast_is_short_circuited(source_ast)) {
3474-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot take reference of a nullsafe chain");
3475-
}
3479+
zend_assert_not_short_circuited(source_ast);
34763480
if (is_globals_fetch(source_ast)) {
34773481
zend_error_noreturn(E_COMPILE_ERROR, "Cannot acquire reference to $GLOBALS");
34783482
}
@@ -5173,10 +5177,7 @@ static void zend_compile_return(zend_ast *ast) /* {{{ */
51735177
expr_node.op_type = IS_CONST;
51745178
ZVAL_NULL(&expr_node.u.constant);
51755179
} else if (by_ref && zend_is_variable(expr_ast)) {
5176-
if (zend_ast_is_short_circuited(expr_ast)) {
5177-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot take reference of a nullsafe chain");
5178-
}
5179-
5180+
zend_assert_not_short_circuited(expr_ast);
51805181
zend_compile_var(&expr_node, expr_ast, BP_VAR_W, 1);
51815182
} else {
51825183
zend_compile_expr(&expr_node, expr_ast);
@@ -9512,6 +9513,7 @@ static void zend_compile_yield(znode *result, zend_ast *ast) /* {{{ */
95129513

95139514
if (value_ast) {
95149515
if (returns_by_ref && zend_is_variable(value_ast)) {
9516+
zend_assert_not_short_circuited(value_ast);
95159517
zend_compile_var(&value_node, value_ast, BP_VAR_W, 1);
95169518
} else {
95179519
zend_compile_expr(&value_node, value_ast);

Zend/zend_execute.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,9 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
32283228
}
32293229
}
32303230

3231+
/* Pointer on property callback is required */
3232+
ZEND_ASSERT(zobj->handlers->get_property_ptr_ptr != NULL);
3233+
32313234
if (prop_op_type == IS_CONST) {
32323235
name = Z_STR_P(prop_ptr);
32333236
} else {

0 commit comments

Comments
 (0)