Repository navigation
Expand file tree
/
Copy pathUPGRADING.INTERNALS
More file actions
196 lines (168 loc) · 8.99 KB
/
Copy pathUPGRADING.INTERNALS
File metadata and controls
196 lines (168 loc) · 8.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
PHP 8.7 INTERNALS UPGRADE NOTES
1. Internal API changes
2. Build system changes
3. Module changes
4. OpCode changes
5. SAPI changes
========================
1. Internal API changes
========================
- Breaking changes:
. Added zend_module_entry.child_init_func, an optional void callback invoked
by php_child_init() in the child process after core child initialization.
It runs in module dependency order for started modules and may run before a
request starts or during an active request. Initialize it with a designated
initializer such as `.child_init_func = callback` after
STANDARD_MODULE_PROPERTIES_EX.
. Function pointer signature for interface_gets_implemented has been made
void. Implementations are expected to use zend_error_noreturn upon failure.
. Redefined ZEND_NORETURN to make use of the [[noreturn]] attribute for C++
and C23, which means that ZEND_NORETURN needs to come first in the modifier
list. Consider using noreturn (C11) / [[noreturn]] (C23) directly if
header interoperability is not required.
. Using zend_array_destroy() on HashTables with a custom pDestructor is not
allowed anymore. User-facing HashTables must have pDestructor = ZVAL_PTR_DTOR
or NULL, and must be freed with zend_array_destroy(). Other HashTables can
be freed with zend_hash_destroy() + pefree().
. Removed ZEND_ACC_PTR_OPS. Attributes of user constants are now stored in
the attributes table of the declaring file's main op_array.
zend_constant.attributes can therefore be shared.
Use zend_constant_attributes_offset() to get the offset of a constant's own attributes.
Added zend_get_attribute_str_ex() to look up an attribute at a raw offset.
. The following globals have been moved from ext/standard/file.h to
php_globals.h, meaning the access macro is now PG() and no longer FG():
* auto_detect_line_endings
* default_socket_timeout
* user_stream_current_filename
* stream_wrappers
* stream_filters
* wrapper_logged_errors
* stream_error_state
The motivation is to remove cyclic dependencies from PHP, as such it may be
possible to omit including ext/standard/file.h to access those globals.
. The flock_compat.h header has been moved from the ext/standard/ folder to
the main/ folder. The motivation for this change is to remove cyclic
dependencies from PHP.
- Removed:
. The ZEND_LOG_XOR() macro was removed.
. The ZEND_TRUTH() macro was removed.
. Removed zend_execute_scripts(). Manually call zend_execute_script() in a
loop instead.
. Removed ZEND_STATIC_ASSERT(). Use C11 static_assert() directly instead.
. Removed zend_atomic.h and the zend_atomic_* types and functions.
Use the standard C11 atomic_* types and functions instead.
. The zend_error_noreturn_unchecked() function was removed.
. The sapi_terminate_process() function was removed.
. The sapi_force_http_10() function was removed.
. The sapi_get_fd() function was removed.
. The sapi_get_target_uid() function was removed.
. The sapi_get_target_gid() function was removed.
. The sapi_activate_headers_only() function was removed.
. The sapi_register_default_post_reader() function was removed. The default
POST reader indirection was vestigial. Register POST entries instead.
. The php_startup_sapi_content_types() function was removed.
. The php_setup_sapi_content_types() function was removed.
. Removed zend_hrtime_posix_clock_id. zend_hrtime() always uses
CLOCK_MONOTONIC on POSIX platforms.
. The INIT_CLASS_ENTRY_INIT_METHODS() macro, which was previously used as
part of handling disabled classes, was removed following the removal of
the `disable_classes` INI setting in PHP 8.5.
. Removed HAVE_NORETURN and HAVE_NORETURN_ALIAS. ZEND_NORETURN is guaranteed
to work.
. CG(), EG(), PG(), SG(), CWDG(), SIGG(), ZCG(), JIT_G(), INI_SCNG(), PCRE_G()
and BG() use native TLS in ZTS builds. The compiler_globals_offset,
executor_globals_offset, core_globals_offset, sapi_globals_offset, cwd_globals_offset,
zend_signal_globals_offset, accel_globals_offset, jit_globals_offset and
ini_scanner_globals_offset symbols have been removed.
. php_reserve_tsrm_memory() has been removed.
- Changed:
. The signature of zend_is_callable() has been changed to
zend_is_callable(const zval *callable, zend_fcall_info_cache *fcc, char **error)
from zend_is_callable(const zval *callable, uint32_t check_flags, zend_string **callable_name).
This new signature covers the most common parameters used with
zend_is_callable_ex().
- Added:
. The zend_object_copy() function was added to increases the refcount of a
zend_object* and returns it. Allowing more descriptive code rather than
doing an assignment followed by GC_ADDREF().
. The zend_call_method_if_exists_ex() was added to accepts named parameters
and retrieving the callability failure error message.
. The zend_accel_restart_hook callback was added. OPcache calls it once a
scheduled restart has been carried out and the SHM lock is released, on
the thread that carried it out, with the same reason as the
zend_accel_schedule_restart_hook callback.
. ZEND_IN_RANGE_OF(x, T) was added to check whether the value of an integer
x is representable in the integer type T.
. ZEND_TYPE_MIN(T) and ZEND_TYPE_MAX(T) were added.
. php_post_entries is now exposed as a symbol. Anything replacing POST
handlers should use this when switching back to PHP's defaults, rather
than having a copy of it.
- Deprecated:
. ZEND_LONG_INT_OVFL(), ZEND_LONG_INT_UDFL(), ZEND_LONG_EXCEEDS_INT(),
ZEND_LONG_UINT_OVFL(), ZEND_SIZE_T_INT_OVFL(), ZEND_SIZE_T_UINT_OVFL() and
the *_CAN_OVFL_* flags were deprecated. Use ZEND_IN_RANGE_OF() instead.
========================
2. Build system changes
========================
- Windows build system changes:
. C sources are now compiled as C17 and require C11 atomics. MSVC builds require
Visual Studio 2026 or later and enable /experimental:c11atomics.
. C++-only extension compiler flags can be added to CXXFLAGS_<EXTENSION>.
- Unix build system changes:
. Autoconf minimum required version upgraded to 2.71.
========================
3. Module changes
========================
- Date:
. Added php_date_time_duration_create() to create Time\Duration objects
without going through the userland API.
- libxml:
. The signature of php_libxml_switch_context() changed from
void php_libxml_switch_context(const zval *context, zval *oldcontext) to
php_stream_context *php_libxml_switch_context(php_stream_context *context)
- MySQLi:
. Removed the reverse API. The mysqlnd_reverse_api.h header, the
MYSQLND_REVERSE_API struct and the functions zval_to_mysqlnd(),
mysqlnd_reverse_api_register_api() and mysqlnd_reverse_api_get_api_list()
no longer exist.
- Mysqlnd:
. In ZTS builds the values of MYSQLND_STATS are atomic_uint_least64_t and
the LOCK_access member was removed. The MYSQLND_INC_STATISTIC*() and
MYSQLND_DEC_STATISTIC() macros update them with relaxed atomic additions.
. The MYSQLND_STATS_LOCK() and MYSQLND_STATS_UNLOCK() macros were removed.
MYSQLND_STATS_UPDATE_VALUE() is now an expression instead of a block.
- Session:
. The module_number member of php_ps_globals was removed.
- Standard:
. php_explode() now takes a HashTable* instead of a zval* to store the
resulting parts. It already expected the zval* to be IS_ARRAY.
. _php_math_basetozval() now returns zend_result instead of void. It throws
an exception and returns FAILURE if the input contains invalid characters
for the given base.
. php_dl() has been removed, use php_load_extension() instead.
. Added php_next_utf8_char_fast() to ext/standard/html.h. It has the same
contract as php_next_utf8_char() and decodes valid UTF-8 at the call
site.
========================
4. OpCode changes
========================
- ZEND_DECLARE_ATTRIBUTED_CONST no longer has an OP_DATA opline.
The offset of the constant's attributes in the op_array's attributes table is stored in extended_value.
========================
5. SAPI changes
========================
- The size of the SAPI structure has changed.
. The terminate_process method has been removed.
. The force_http_10 method has been removed.
. The get_fd method has been removed.
. The get_target_uid and get_target_gid methods have been removed.
. The default_post_reader method has been removed.
- The sapi_getenv method now returns an allocated zend_string. Previously, it
returned a pointer to the system environment buffer on Unix and an allocated
string on Windows.
- Per-thread TSRM resources are now released best-effort at normal thread exit,
because native TLS resource destructors can only run on their owning thread and
tsrm_shutdown() cannot release them afterwards. Prefer explicitly calling ts_free_thread().
- tsrm_shutdown() and the bundled library-unload hooks automatically disarm
thread-exit cleanup. Embedders must stop and join all PHP worker threads
before calling tsrm_shutdown() or unloading PHP.