Skip to content

Commit f768048

Browse files
committed
Merge branch 'master' into gh19637-closure-scope
2 parents b033306 + 0b74e59 commit f768048

26 files changed

+255
-73
lines changed

.github/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@
492492
- 'ext/spl/spl_iterators.h'
493493
- 'ext/spl/spl_observer.h'
494494
- 'ext/standard/*.h'
495+
- 'ext/uri/*.h'
495496
- 'ext/xml/expat_compat.h'
496497
- 'ext/xml/php_xml.h'
497498
- 'main/*.h'

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ PHP NEWS
2323
. Fixed memory management of Uri\WhatWg\Url objects. (timwolla)
2424
. Fixed memory management of the internal "parse_url" URI parser.
2525
(timwolla)
26+
. Fixed double-free when assigning to $errors fails when using
27+
the Uri\WhatWg\Url parser. (timwolla)
28+
. Reject out-of-range ports when using the Uri\Rfc3986\Uri parser.
29+
(timwolla)
2630
. Clean up naming of internal API. (timwolla)
2731

2832
28 Aug 2025, PHP 8.5.0beta2

UPGRADING.INTERNALS

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ PHP 8.5 INTERNALS UPGRADE NOTES
1414
1. Internal API changes
1515
========================
1616

17-
- Core
1817
. PG(arg_separator).input and PG(arg_separator).output are now `zend_string*`
1918
instead of `char*`.
2019
. DL_LOAD now doesn't use RTLD_DEEPBIND deepbind anymore on platforms
@@ -34,16 +33,6 @@ PHP 8.5 INTERNALS UPGRADE NOTES
3433
pointer. If the error will be delayed until runtime, it is stored in the
3534
new `validation_error` field of the `zend_attribute` struct.
3635
RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute
37-
38-
- Hash
39-
. Hash functions now use proper hash_spec_result enum for return values
40-
instead of using SUCCESS and FAILURE.
41-
42-
- Random
43-
. The handlers parameter of php_random_engine_common_init() has been
44-
removed. Use the default_object_handlers field on the CE instead.
45-
46-
- Zend
4736
. Added zend_safe_assign_to_variable_noref() function to safely assign
4837
a value to a non-reference zval.
4938
. Added zval_ptr_safe_dtor() to safely destroy a zval when a destructor
@@ -91,13 +80,6 @@ PHP 8.5 INTERNALS UPGRADE NOTES
9180
from the parent process after a fork().
9281
. HASH_KEY_IS_* constants have been moved in the zend_hash_key_type enum.
9382

94-
- standard
95-
. ext/standard/php_smart_string.h and ext/standard/php_smart_string_public.h
96-
were removed. Use the corresponding headers in Zend/ instead.
97-
98-
- URI
99-
. Internal API for URI handling was added via the php_uri_*() functions.
100-
10183
========================
10284
2. Build system changes
10385
========================
@@ -136,26 +118,34 @@ PHP 8.5 INTERNALS UPGRADE NOTES
136118
3. Module changes
137119
========================
138120

139-
- ext/gd
121+
- Gd:
140122
. The gdImageScale*() and gdImageRotate*() helpers are now internal in the
141123
bundled libgd, like they have been in external libgd as of gd-2.1.1.
142124

143-
- ext/json
125+
- Hash:
126+
. Hash functions now use proper hash_spec_result enum for return values
127+
instead of using SUCCESS and FAILURE.
128+
129+
- JSON:
144130
. php_json_encode_serializable_object() now assumes `EG(active)`,
145131
if not a bailout is caused. Therefore a minor BC break exists if the
146132
`PHP_JSON_PARTIAL_OUTPUT_ON_ERROR` option is in use.
147133
However, this situation is highly unlikely.
148134

149-
- ext/libxml
135+
- Libxml:
150136
. The refcount APIs now return an `unsigned int` instead of an `int`.
151137
. Removed php_libxml_xmlCheckUTF8(). Use xmlCheckUTF8() from libxml instead.
152138

153-
- ext/pdo
139+
- PDO:
154140
. Added `php_pdo_stmt_valid_db_obj_handle()` to check if the database object
155141
is still valid. This is useful when a GC cycle is collected and the
156142
database object can be destroyed prior to destroying the statement.
157143

158-
- ext/standard
144+
- Random:
145+
. The handlers parameter of php_random_engine_common_init() has been
146+
removed. Use the default_object_handlers field on the CE instead.
147+
148+
- Standard:
159149
. Added php_url_decode_ex() and php_raw_url_decode_ex() that unlike their
160150
non-ex counterparts do not work in-place.
161151
. The php_std_date() function has been removed. Use php_format_date() with
@@ -165,6 +155,11 @@ PHP 8.5 INTERNALS UPGRADE NOTES
165155
and image_type_to_extension() is now extensible using the internal APIs
166156
php_image_register_handler() and php_image_unregister_handler() in
167157
php_image.h.
158+
. ext/standard/php_smart_string.h and ext/standard/php_smart_string_public.h
159+
were removed. Use the corresponding headers in Zend/ instead.
160+
161+
- URI:
162+
. Internal API for URI handling was added via the php_uri_*() functions.
168163

169164
========================
170165
4. OpCode changes

Zend/Optimizer/zend_func_infos.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static const func_info_t func_infos[] = {
510510
F1("getcwd", MAY_BE_STRING|MAY_BE_FALSE),
511511
F1("readdir", MAY_BE_STRING|MAY_BE_FALSE),
512512
F1("scandir", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
513-
F1("glob", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
513+
FN("glob", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
514514
F1("exec", MAY_BE_STRING|MAY_BE_FALSE),
515515
F1("system", MAY_BE_STRING|MAY_BE_FALSE),
516516
F1("escapeshellcmd", MAY_BE_STRING),

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ AS_VAR_IF([cross_compiling], [yes],
128128
AC_MSG_RESULT([$BUILD_CC])],
129129
[BUILD_CC=$CC])
130130

131+
dnl The macro AC_PROG_CC_C99 sets the shell variable ac_cv_prog_cc_c99 to 'no'
132+
dnl if the compiler does not support C99.i.e. does not support any of _Bool,
133+
dnl flexible arrays, inline, long long int, mixed code and declarations,
134+
dnl named initialization of structs, restrict, varargs macros, variable
135+
dnl declarations in for loops and variable length arrays.
136+
dnl
137+
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html
138+
if test "$ac_cv_prog_cc_c99" = no; then
139+
AC_MSG_ERROR([C compiler would not accept C99 code])
140+
fi
141+
131142
dnl Support systems with system libraries in e.g. /usr/lib64.
132143
PHP_ARG_WITH([libdir],
133144
[for system library directory],

ext/filter/logical_filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ zend_result php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
612612
int parser_name_set;
613613
FETCH_STR_OPTION(parser_name, URL_OPTION_URI_PARSER_CLASS);
614614

615-
uri_parser_t *uri_parser = php_uri_get_parser(parser_name_set ? parser_name : NULL);
615+
const uri_parser_t *uri_parser = php_uri_get_parser(parser_name_set ? parser_name : NULL);
616616
if (uri_parser == NULL) {
617617
zend_value_error("%s(): \"uri_parser_class\" option has invalid value", get_active_function_name());
618618
RETURN_VALIDATION_FAILED
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Dynamically setting opcache.enable does not warn when noop
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--EXTENSIONS--
7+
opcache
8+
--FILE--
9+
<?php
10+
11+
echo "Should not warn:", PHP_EOL;
12+
ini_set('opcache.enable', 1);
13+
echo "Disabling:", PHP_EOL;
14+
ini_set('opcache.enable', 0);
15+
echo "Should warn:", PHP_EOL;
16+
ini_set('opcache.enable', 1);
17+
18+
?>
19+
--EXPECTF--
20+
Should not warn:
21+
Disabling:
22+
Should warn:
23+
24+
Warning: Zend OPcache can't be temporarily enabled (it may be only disabled until the end of request) in %s on line %d
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Dynamically setting opcache.enable warns when not a noop
3+
--INI--
4+
opcache.enable=0
5+
opcache.enable_cli=1
6+
--EXTENSIONS--
7+
opcache
8+
--FILE--
9+
<?php
10+
11+
echo "Should warn, since the INI was initialized to 0:", PHP_EOL;
12+
ini_set('opcache.enable', 1);
13+
14+
?>
15+
--EXPECTF--
16+
Should warn, since the INI was initialized to 0:
17+
18+
Warning: Zend OPcache can't be temporarily enabled (it may be only disabled until the end of request) in %s on line %d

ext/opcache/zend_accelerator_module.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,23 @@ static ZEND_INI_MH(OnEnable)
159159
stage == ZEND_INI_STAGE_DEACTIVATE) {
160160
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
161161
} else {
162-
/* It may be only temporary disabled */
162+
/* It may be only temporarily disabled */
163163
bool *p = (bool *) ZEND_INI_GET_ADDR();
164164
if (zend_ini_parse_bool(new_value)) {
165-
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
165+
if (*p) {
166+
/* Do not warn if OPcache is enabled, as the update would be a noop anyways. */
167+
return SUCCESS;
168+
}
169+
170+
if (stage == ZEND_INI_STAGE_ACTIVATE) {
171+
if (strcmp(sapi_module.name, "fpm-fcgi") == 0) {
172+
zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporarily enabled. Are you using php_admin_value[opcache.enable]=1 in an individual pool's configuration?");
173+
} else {
174+
zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporarily enabled (it may be only disabled until the end of request)");
175+
}
176+
} else {
177+
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporarily enabled (it may be only disabled until the end of request)");
178+
}
166179
return FAILURE;
167180
} else {
168181
*p = 0;

ext/openssl/xp_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,7 @@ static char *php_openssl_get_url_name(const char *resourcename,
26342634
return NULL;
26352635
}
26362636

2637-
uri_parser_t *uri_parser = php_stream_context_get_uri_parser("ssl", context);
2637+
const uri_parser_t *uri_parser = php_stream_context_get_uri_parser("ssl", context);
26382638
if (uri_parser == NULL) {
26392639
zend_value_error("%s(): Provided stream context has invalid value for the \"uri_parser_class\" option", get_active_function_name());
26402640
return NULL;

0 commit comments

Comments
 (0)