Skip to content

Commit 4977ef6

Browse files
committed
Merge branch 'master' into clone-function
2 parents 6ee0ef1 + 5ed8b2b commit 4977ef6

File tree

71 files changed

+514
-723
lines changed

Some content is hidden

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

71 files changed

+514
-723
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ PHP NEWS
5858
. Added the pipe (|>) operator. (crell)
5959
. Added support for `final` with constructor property promotion.
6060
(DanielEScherzer)
61+
. Do not use RTLD_DEEPBIND if dlmopen is available. (Daniil Gentili)
6162

6263
- Curl:
6364
. Added curl_multi_get_handles(). (timwolla)
@@ -260,6 +261,10 @@ PHP NEWS
260261
. Added array_first() and array_last(). (nielsdos)
261262
. Fixed bug GH-18823 (setlocale's 2nd and 3rd argument ignores strict_types).
262263
(nielsdos)
264+
. Fixed exit code handling of sendmail cmd and added warnings.
265+
(Jesse Hathaway)
266+
. Fixed bug GH-18897 (printf: empty precision is interpreted as precision 6,
267+
not as precision 0). (nielsdos)
263268

264269
- Streams:
265270
. Fixed bug GH-16889 (stream_select() timeout useless for pipes on Windows).

UPGRADING

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ PHP 8.5 UPGRADE NOTES
116116
. SplFileObject::fwrite's parameter $length is now nullable. The default
117117
value changed from 0 to null.
118118

119+
- Standard:
120+
. Using a printf-family function with a formatter that did not specify the
121+
precision previously incorrectly reset the precision instead of treating
122+
it as a precision of 0. See GH-18897.
123+
119124
========================================
120125
2. New Features
121126
========================================
@@ -217,6 +222,12 @@ PHP 8.5 UPGRADE NOTES
217222
Sqlite3Stmt::EXPLAIN_MODE_EXPLAIN and
218223
Sqlite3Stmt::EXPLAIN_MODE_EXPLAIN_QUERY_PLAN.
219224

225+
- Standard:
226+
. mail() now returns the actual sendmail error and detects if the sendmail
227+
process was terminated unexpectedly. In such cases, a warning is emitted
228+
and the function returns false. Previously, these errors were silently
229+
ignored. This change affects only the sendmail transport.
230+
220231
- XSL:
221232
. The $namespace argument of XSLTProcessor::getParameter(),
222233
XSLTProcessor::setParameter() and XSLTProcessor::removeParameter()

UPGRADING.INTERNALS

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ PHP 8.5 INTERNALS UPGRADE NOTES
1717
- Core
1818
. PG(arg_separator).input and PG(arg_separator).output are now `zend_string*`
1919
instead of `char*`.
20+
. DL_LOAD now doesn't use RTLD_DEEPBIND deepbind anymore on platforms
21+
where dlmopen with LM_ID_NEWLM is available:
22+
this means shared library symbol isolation (if needed) must be enabled on
23+
the user side when requiring libphp.so, by using dlmopen with LM_ID_NEWLM
24+
instead of dlopen.
25+
RTLD_DEEPBIND is still enabled when the Apache SAPI is in use.
2026

2127
- Zend
2228
. Added zend_safe_assign_to_variable_noref() function to safely assign
@@ -37,6 +43,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
3743
. Added the zend_update_exception_properties() function for instantiating
3844
Exception child classes. It updates the $message, $code, and $previous
3945
properties.
46+
. ZEND_IS_XDIGIT() macro was removed because it was unused and its name
47+
did not match its actual behavior.
4048

4149
========================
4250
2. Build system changes
@@ -49,12 +57,18 @@ PHP 8.5 INTERNALS UPGRADE NOTES
4957
without duplicate build rules. It is up to the SAPI maintainers to ensure
5058
that appropriate build rules are created.
5159

52-
- Linux build system changes
60+
- Unix build system changes
5361
. libdir is properly set when --libdir (ex: /usr/lib64) and --with-libdir (ex lib64)
5462
configure options are used to ${libdir}/php (ex: /usr/lib64/php)
5563
. PHP_ODBC_CFLAGS, PHP_ODBC_LFLAGS, PHP_ODBC_LIBS, PHP_ODBC_TYPE preprocessor
5664
macros defined by ext/odbc are now defined in php_config.h instead of the
5765
build-defs.h header.
66+
. Autoconf macro PHP_AP_EXTRACT_VERSION has been removed.
67+
. Autoconf macro PHP_BUILD_THREAD_SAFE has been removed (set enable_zts
68+
manually).
69+
. Autoconf macro PHP_DEF_HAVE has been removed (use AC_DEFINE).
70+
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
71+
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
5872

5973
========================
6074
3. Module changes

Zend/tests/gh18907.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
GH-18907: Leak when creating cycle inside hook
3+
--FILE--
4+
<?php
5+
6+
class Foo {
7+
public $prop {
8+
get {
9+
$this->prop = $this;
10+
return 1;
11+
}
12+
}
13+
}
14+
15+
function test() {
16+
var_dump((new Foo)->prop);
17+
}
18+
19+
/* Call twice to test the ZEND_IS_PROPERTY_HOOK_SIMPLE_GET() path. */
20+
test();
21+
test();
22+
23+
?>
24+
--EXPECT--
25+
int(1)
26+
int(1)

Zend/zend_API.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,20 @@
4040
/* these variables are true statics/globals, and have to be mutex'ed on every access */
4141
ZEND_API HashTable module_registry;
4242

43+
ZEND_API bool zend_dl_use_deepbind = false;
44+
4345
static zend_module_entry **module_request_startup_handlers;
4446
static zend_module_entry **module_request_shutdown_handlers;
4547
static zend_module_entry **module_post_deactivate_handlers;
4648
static zend_module_entry **modules_dl_loaded;
4749

4850
static zend_class_entry **class_cleanup_handlers;
4951

52+
ZEND_API void zend_set_dl_use_deepbind(bool use_deepbind)
53+
{
54+
zend_dl_use_deepbind = use_deepbind;
55+
}
56+
5057
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */
5158
{
5259
zval *param_ptr;

Zend/zend_API.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ typedef struct _zend_fcall_info_cache {
343343
ZEND_API int zend_next_free_module(void);
344344

345345
BEGIN_EXTERN_C()
346+
ZEND_API void zend_set_dl_use_deepbind(bool use_deepbind);
347+
346348
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array);
347349

348350
/* internal function to efficiently copy parameters when executing __call() */

Zend/zend_object_handlers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,9 @@ static bool zend_call_get_hook(
722722
return false;
723723
}
724724

725+
GC_ADDREF(zobj);
725726
zend_call_known_instance_method_with_0_params(get, zobj, rv);
727+
OBJ_RELEASE(zobj);
726728

727729
return true;
728730
}

Zend/zend_operators.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ static zend_always_inline zend_long zend_dval_to_lval_safe(double d)
156156
}
157157

158158
#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
159-
#define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
160159

161160
static zend_always_inline uint8_t is_numeric_string_ex(const char *str, size_t length, zend_long *lval,
162161
double *dval, bool allow_errors, int *oflow_info, bool *trailing_data)

Zend/zend_portability.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@
165165
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
166166
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
167167
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
168-
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
168+
# if defined(LM_ID_NEWLM)
169+
ZEND_API extern bool zend_dl_use_deepbind;
170+
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (zend_dl_use_deepbind ? RTLD_DEEPBIND : 0))
171+
# else
172+
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
173+
# endif
169174
# else
170175
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
171176
# endif

Zend/zend_string.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ static zend_always_inline void zend_init_interned_strings_ht(HashTable *interned
8686
ZEND_API void zend_interned_strings_init(void)
8787
{
8888
char s[2];
89-
unsigned int i;
90-
zend_string *str;
9189

9290
interned_string_request_handler = zend_new_interned_string_request;
9391
interned_string_init_request_handler = zend_string_init_interned_request;
@@ -103,25 +101,22 @@ ZEND_API void zend_interned_strings_init(void)
103101
zend_string_init_existing_interned = zend_string_init_existing_interned_permanent;
104102

105103
/* interned empty string */
106-
str = zend_string_alloc(sizeof("")-1, 1);
107-
ZSTR_VAL(str)[0] = '\000';
108-
zend_empty_string = zend_new_interned_string_permanent(str);
104+
zend_empty_string = zend_string_init_interned_permanent("", 0, true);
109105
GC_ADD_FLAGS(zend_empty_string, IS_STR_VALID_UTF8);
110106

111107
s[1] = 0;
112-
for (i = 0; i < 256; i++) {
108+
for (size_t i = 0; i < 256; i++) {
113109
s[0] = i;
114-
zend_one_char_string[i] = zend_new_interned_string_permanent(zend_string_init(s, 1, 1));
110+
zend_one_char_string[i] = zend_string_init_interned_permanent(s, 1, true);
115111
if (i < 0x80) {
116112
GC_ADD_FLAGS(zend_one_char_string[i], IS_STR_VALID_UTF8);
117113
}
118114
}
119115

120116
/* known strings */
121117
zend_known_strings = pemalloc(sizeof(zend_string*) * ((sizeof(known_strings) / sizeof(known_strings[0]) - 1)), 1);
122-
for (i = 0; i < (sizeof(known_strings) / sizeof(known_strings[0])) - 1; i++) {
123-
str = zend_string_init(known_strings[i], strlen(known_strings[i]), 1);
124-
zend_known_strings[i] = zend_new_interned_string_permanent(str);
118+
for (size_t i = 0; i < (sizeof(known_strings) / sizeof(known_strings[0])) - 1; i++) {
119+
zend_known_strings[i] = zend_string_init_interned_permanent(known_strings[i], strlen(known_strings[i]), true);
125120
GC_ADD_FLAGS(zend_known_strings[i], IS_STR_VALID_UTF8);
126121
}
127122
}

0 commit comments

Comments
 (0)