Skip to content

Commit c3a07cf

Browse files
authored
Merge branch 'php:master' into fix-ini-set-mbstring-detect-order-is-ignored
2 parents 8d6f8c3 + 1848bcd commit c3a07cf

File tree

64 files changed

+1081
-442
lines changed

Some content is hidden

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

64 files changed

+1081
-442
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--------------------------------------------------------------------
22
The PHP License, version 3.01
3-
Copyright (c) 1999 - 2024 The PHP Group. All rights reserved.
3+
Copyright (c) 1999 - 2025 The PHP Group. All rights reserved.
44
--------------------------------------------------------------------
55

66
Redistribution and use in source and binary forms, with or without

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ PHP NEWS
3333
. Fixed bug GH-20217 (ReflectionClass::isIterable() incorrectly returns true
3434
for classes with property hooks). (alexandre-daubois)
3535

36+
- Soap:
37+
. Soap::__setCookie() when cookie name is a digit is now not stored and represented
38+
as a string anymore but a int. (David Carlier)
39+
3640
- Standard:
3741
. Fixed bug GH-19926 (reset internal pointer earlier while splicing array
3842
while COW violation flag is still set). (alexandre-daubois)

Zend/Zend.m4

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ dnl expectations.
474474
dnl
475475
AC_DEFUN([ZEND_CHECK_PRESERVE_NONE], [dnl
476476
AC_CACHE_CHECK([for preserve_none calling convention],
477-
[php_cv_preverve_none],
477+
[php_cv_preserve_none],
478478
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
479479
#include <stdio.h>
480480
#include <stdint.h>
@@ -504,7 +504,11 @@ uintptr_t __attribute__((preserve_none)) test(void) {
504504
"movq %2, %%r13\n"
505505
"xorq %3, %%r13\n"
506506
"xorq %%rax, %%rax\n"
507+
#if defined(__APPLE__)
508+
"call _fun\n"
509+
#else
507510
"call fun\n"
511+
#endif
508512
: "=a" (ret)
509513
: "r" (const1), "r" (const2), "r" (key)
510514
: "r12", "r13"
@@ -515,7 +519,11 @@ uintptr_t __attribute__((preserve_none)) test(void) {
515519
"eor x20, %1, %3\n"
516520
"eor x21, %2, %3\n"
517521
"eor x0, x0, x0\n"
522+
#if defined(__APPLE__)
523+
"bl _fun\n"
524+
#else
518525
"bl fun\n"
526+
#endif
519527
"mov %0, x0\n"
520528
: "=r" (ret)
521529
: "r" (const1), "r" (const2), "r" (key)

Zend/zend_API.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,6 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
592592
return 0;
593593
}
594594
}
595-
if (UNEXPECTED(EG(exception))) {
596-
return 0;
597-
}
598595
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
599596
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) {
600597
return 0;
@@ -641,9 +638,6 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double *
641638
return 0;
642639
}
643640
}
644-
if (UNEXPECTED(EG(exception))) {
645-
return 0;
646-
}
647641
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
648642
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("float", arg_num)) {
649643
return 0;

Zend/zend_language_scanner.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#ifndef ZEND_SCANNER_H
2121
#define ZEND_SCANNER_H
2222

23+
/* The zend_php_scanner_event enum is declared in zend_globals and we don't want everything to include zend_language_scanner.h */
2324
#include "zend_globals.h"
2425

2526
typedef struct _zend_lex_state {
@@ -71,7 +72,7 @@ typedef struct _zend_heredoc_label {
7172
/* Track locations of unclosed {, [, (, etc. for better syntax error reporting */
7273
typedef struct _zend_nest_location {
7374
char text;
74-
int lineno;
75+
uint32_t lineno;
7576
} zend_nest_location;
7677

7778
BEGIN_EXTERN_C()

Zend/zend_language_scanner.l

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "zend_language_scanner_defs.h"
3131

3232
#include <errno.h>
33+
#include <stdint.h>
3334
#include "zend.h"
3435
#ifdef ZEND_WIN32
3536
# include <Winuser.h>
@@ -600,7 +601,7 @@ static zend_op_array *zend_compile(int type)
600601
CG(ast_arena) = zend_arena_create(1024 * 32);
601602

602603
if (!zendparse()) {
603-
int last_lineno = CG(zend_lineno);
604+
uint32_t last_lineno = CG(zend_lineno);
604605
zend_file_context original_file_context;
605606
zend_oparray_context original_oparray_context;
606607
zend_op_array *original_active_op_array = CG(active_op_array);
@@ -1140,7 +1141,7 @@ skip_escape_conversion:
11401141
unsigned char *str;
11411142
// TODO: avoid realocation ???
11421143
s = Z_STRVAL_P(zendlval);
1143-
SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval));
1144+
SCNG(output_filter)(&str, &sz, (unsigned char *)s, Z_STRLEN_P(zendlval));
11441145
zval_ptr_dtor(zendlval);
11451146
ZVAL_STRINGL(zendlval, (char *) str, sz);
11461147
efree(str);
@@ -1172,7 +1173,7 @@ static bool strip_multiline_string_indentation(
11721173
const char *str = Z_STRVAL_P(zendlval), *end = str + Z_STRLEN_P(zendlval);
11731174
char *copy = Z_STRVAL_P(zendlval);
11741175

1175-
int newline_count = 0;
1176+
uint32_t newline_count = 0;
11761177
size_t newline_len;
11771178
const char *nl;
11781179

@@ -1253,7 +1254,7 @@ static void copy_heredoc_label_stack(void *void_heredoc_label)
12531254
}
12541255

12551256
/* Check that { }, [ ], ( ) are nested correctly */
1256-
static void report_bad_nesting(char opening, int opening_lineno, char closing)
1257+
static void report_bad_nesting(char opening, uint32_t opening_lineno, char closing)
12571258
{
12581259
char buf[256];
12591260
size_t used = 0;
@@ -1361,7 +1362,7 @@ int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem)
13611362
{
13621363
int token;
13631364
int offset;
1364-
int start_line = CG(zend_lineno);
1365+
uint32_t start_line = CG(zend_lineno);
13651366

13661367
ZVAL_UNDEF(zendlval);
13671368
restart:
@@ -2499,7 +2500,7 @@ inline_char_handler:
24992500
if (YYCURSOR < YYLIMIT) {
25002501
YYCURSOR++;
25012502
} else {
2502-
zend_throw_exception_ex(zend_ce_parse_error, 0, "Unterminated comment starting line %d", CG(zend_lineno));
2503+
zend_throw_exception_ex(zend_ce_parse_error, 0, "Unterminated comment starting line %" PRIu32, CG(zend_lineno));
25032504
if (PARSER_MODE()) {
25042505
RETURN_TOKEN(T_ERROR);
25052506
}
@@ -2616,7 +2617,7 @@ skip_escape_conversion:
26162617
zend_string *new_str;
26172618
s = Z_STRVAL_P(zendlval);
26182619
// TODO: avoid reallocation ???
2619-
SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval));
2620+
SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, Z_STRLEN_P(zendlval));
26202621
new_str = zend_string_init(str, sz, 0);
26212622
if (str != s) {
26222623
efree(str);

Zend/zend_list.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,34 @@ void zend_init_rsrc_plist(void)
214214

215215
void zend_close_rsrc_list(HashTable *ht)
216216
{
217-
/* Reload ht->arData on each iteration, as it may be reallocated. */
218217
uint32_t i = ht->nNumUsed;
218+
uint32_t num = ht->nNumUsed;
219219

220220
retry:
221221
zend_try {
222222
while (i-- > 0) {
223+
/* Reload ht->arData on each iteration, as it may be reallocated. */
223224
zval *p = ZEND_HASH_ELEMENT(ht, i);
224225
if (Z_TYPE_P(p) != IS_UNDEF) {
225226
zend_resource *res = Z_PTR_P(p);
226227
if (res->type >= 0) {
227228
zend_resource_dtor(res);
229+
230+
if (UNEXPECTED(ht->nNumUsed != num)) {
231+
/* New resources were added, reloop from the start.
232+
* We need to keep the top->down order to avoid freeing resources
233+
* in use by the newly created resources. */
234+
i = num = ht->nNumUsed;
235+
}
228236
}
229237
}
230238
}
231239
} zend_catch {
240+
if (UNEXPECTED(ht->nNumUsed != num)) {
241+
/* See above */
242+
i = num = ht->nNumUsed;
243+
}
244+
232245
/* If we have bailed, we probably executed user code (e.g. user stream
233246
* API). Keep closing resources so they don't leak. User handlers must be
234247
* called now so they aren't called in zend_deactivate() on

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9800,7 +9800,7 @@ ZEND_VM_HANDLER(204, ZEND_FRAMELESS_ICALL_0, UNUSED, UNUSED, SPEC(OBSERVER))
98009800
#endif
98019801
{
98029802
zend_frameless_function_0 function = (zend_frameless_function_0)ZEND_FLF_HANDLER(opline);
9803-
function(EX_VAR(opline->result.var));
9803+
function(result);
98049804
}
98059805
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
98069806
}

Zend/zend_vm_execute.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/ftp/php_ftp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,18 @@ PHP_FUNCTION(ftp_connect)
147147
RETURN_THROWS();
148148
}
149149

150+
const zend_long timeoutmax = (zend_long)((double) PHP_TIMEOUT_ULL_MAX / 1000000.0);
151+
150152
if (timeout_sec <= 0) {
151153
zend_argument_value_error(3, "must be greater than 0");
152154
RETURN_THROWS();
153155
}
154156

157+
if (timeout_sec >= timeoutmax) {
158+
zend_argument_value_error(3, "must be less than " ZEND_LONG_FMT, timeoutmax);
159+
RETURN_THROWS();
160+
}
161+
155162
/* connect */
156163
if (!(ftp = ftp_open(host, (short)port, timeout_sec))) {
157164
RETURN_FALSE;

0 commit comments

Comments
 (0)