forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 8
/
UPGRADING.INTERNALS
422 lines (375 loc) · 21.3 KB
/
UPGRADING.INTERNALS
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
PHP 8.4 INTERNALS UPGRADE NOTES
1. Internal API changes
2. Build system changes
3. Module changes
4. OpCode changes
5. SAPI changes
========================
1. Internal API changes
========================
* zend_register_module_ex() now takes an additional int module_type argument.
This function will also assign the module number and type, there is no need
to do this at the call site anymore. Writing the handle should happen after
successful registration.
* ZPP now accepts a F or Z_PARAM_FUNC_NO_TRAMPOLINE_FREE type check.
This is identical to the 'f' or Z_PARAM_FUNC type check, except the FCC is
always initialized because it doesn't free trampolines.
Trampolines MUST be freed using zend_release_fcall_info_cache() or consumed.
Z_PARAM_FUNC_EX2 was added as well with the same arguments as Z_PARAM_FUNC_EX
plus an additional argument free_trampoline.
* The zend_object_iterator_funcs valid member has changed its signature from
int(*)(zend_object_iterator *) to zend_result(*)(zend_object_iterator *) to
be more in line with what callbacks are returning.
* The backwards compatibility headers ext/standard/{php_lcg.h,php_mt_rand.h,
php_rand.h,php_random.h} have been removed. Include ext/random/php_random.h
directly.
* The zend_*printf family of functions now supports the "%S" modifier to print
out zend_string*. This won't cut off the string if it embeds a NUL byte.
* The inet_aton() and win32/inet.h have been removed. Use platform-agnostic
inet_pton() from arpa/inet.h or ws2tcpip.h on Windows.
* zend_mm_set_custom_debug_handlers() has been removed from ZendMM, use
zend_mm_set_custom_handlers() instead which now supports DEBUG builds
* zend_mm_set_custom_handlers() has changed its signature from
void()(zend_mm_heap *heap,
void* (*_malloc)(size_t),
void (*_free)(void*),
void* (*_realloc)(void*, size_t))
to
void()(zend_mm_heap *heap,
void* (*_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void (*_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void* (*_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
* zend_mm_get_custom_handlers() has changed its signature from
void()(zend_mm_heap *heap,
void* (**_malloc)(size_t),
void (**_free)(void*),
void* (**_realloc)(void*, size_t))
to
void()(zend_mm_heap *heap,
void* (**_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void (**_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void* (**_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
* Added gc and shutdown custom handlers, settable via
zend_mm_set_custom_handlers_ex()
* __zend_malloc() has changed their signature from
void(*)(size_t) to
void(*)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* __zend_calloc() has changed their signature from
void(*)(size_t, size_t) to
void(*)(size_t, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* __zend_realloc() has changed their signature from
void(*)(void *, size_t) to
void(*)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* zend_observer_remove_begin_handler() and zend_observer_remove_end_handler()
got each a new parameter returning an observer which must be called, if the
removal happened during observer execution.
* zend_get_internal_function_extension_handle[s]() must now be used over
zend_get_op_array_extension_handle[s]() when registering run_time_cache slots
for internal functions. If you need a cache slot for both internal and user
functions, you may obtain a slot for each through the corresponding function.
* zend_is_true now returns bool rather than int. Note that on PHP 8 this has
always returned 0 or 1, so conversion should be trivial.
* Added zend_hash_get_current_pos_ex() variant of zend_hash_get_current_pos().
* Renamed rebuild_object_properties() to rebuild_object_properties_internal().
This function should not be used outside of zend_std_get_properties_ex() and
zend_std_get_properties(). Use zend_std_get_properties_ex() or
zend_std_get_properties() instead.
* zend_object.properties must not be accessed directly. Use
zend_std_get_properties_ex() instead.
* Removed IS_STATIC_VAR_UNINITIALIZED constant. Check for IS_NULL in the
static_variables array instead.
* Removed ZEND_DIM_ALTERNATIVE_SYNTAX constant. This syntax no longer has a
specialized error message.
========================
2. Build system changes
========================
a. Abstract
- The configure option --with-imap has been removed.
- The configure option --with-mhash emits deprecation warning.
- The configure option --with-pdo-oci has been removed.
- The configure option --with-pspell has been removed.
- Symbol SIZEOF_SHORT removed (size of 2 on 32-bit and 64-bit platforms).
- Symbol DBA_CDB_MAKE removed in ext/dba.
- Symbol HAVE_LIBM has been removed.
- Symbol HAVE_INET_ATON has been removed.
- Symbol HAVE_SIGSETJMP has been removed.
- The Zend/zend_istdiostream.h header has been removed.
b. Unix build system changes
- The configure option --with-imap-ssl has been removed.
- The configure option --with-oci8 has been removed.
- The configure option --with-zlib-dir has been removed.
- The configure option --with-kerberos has been removed.
- The configure option --with-openssl-dir has been removed. SSL support in
ext/ftp and ext/mysqlnd is enabled implicitly, when building with
ext/openssl (--with-openssl), or explicitly by using new configure options
--with-ftp-ssl and --with-mysqlnd-ssl.
- New configure option --with-openssl-legacy-provider to enable OpenSSL
legacy provider.
- New configure option --with-openssl-argon2 to enable PASSWORD_ARGON2
from OpenSSL 3.2
- COOKIE_IO_FUNCTIONS_T symbol has been removed (use cookie_io_functions_t).
- HAVE_SOCKADDR_UN_SUN_LEN symbol renamed to HAVE_STRUCT_SOCKADDR_UN_SUN_LEN.
- HAVE_UTSNAME_DOMAINNAME symbol renamed to HAVE_STRUCT_UTSNAME_DOMAINNAME.
- PHP_CHECK_IN_ADDR_T Autoconf macro and 'in_addr_t' fallback definition to
'u_int' removed (use AC_CHECK_TYPES Autoconf macro instead).
- HAVE_ODBC2 symbol has been removed in ext/odbc.
- Removed linking with obsolete dnet_stub library in ext/pdo_dblib.
- Removed checking and linking with obsolete libbind for some functions.
- Symbol HAVE_JSON has been removed (ext/json is always available since PHP
8.0).
- Symbol DARWIN has been removed (use __APPLE__ to target Darwin systems).
- Symbol MISSING_FCLOSE_DECL and Autoconf macro PHP_MISSING_FCLOSE_DECL were
removed.
- Symbol HAVE_BSD_ICONV has been removed.
- Symbol ZEND_FIBER_ASM has been removed.
- Symbols HAVE_DLOPEN and HAVE_DLSYM have been removed.
- Symbol HAVE_MYSQL has been removed.
- Symbol HAVE_PDO_SQLITELIB has been removed.
- Symbol HAVE_WAITPID has been removed.
- Symbol HAVE_LIBPQ has been removed.
- Symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed.
- Symbols PHP_FPM_SYSTEMD, PHP_FPM_USER, and PHP_FPM_GROUP removed.
- Symbol PTHREADS has been removed.
- Symbol HAVE_STRPTIME_DECL_FAILS has been removed (use HAVE_DECL_STRPTIME).
- Symbol HAVE_PHPDBG has been removed.
- Symbols PHP_HAVE_AVX512_SUPPORTS and PHP_HAVE_AVX512_VBMI_SUPPORTS are now
either defined to 1 or undefined.
- Symbol HAVE_LIBCRYPT has been removed.
- Autoconf macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and
config.h).
- Autoconf macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH).
- Autoconf macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES).
- Autoconf macro PHP_SOCKADDR_CHECKS has been removed (use AC_CHECK_TYPES and
AC_CHECK_MEMBERS).
- Autoconf macro PHP_CHECK_GCC_ARG has been removed since PHP 8.0 (use
AX_CHECK_COMPILE_FLAG).
- Autoconf macro PHP_PROG_RE2C got a new 2nd argument to define common
default re2c command-line options substituted to the Makefile RE2C_FLAGS
variable.
- Autoconf macros PHP_CHECK_BUILTIN_* have been removed in favor of
PHP_CHECK_BUILTIN and all PHP_HAVE_BUILTIN_* symbols changed to be either
undefined or defined to 1 whether compiler supports the builtin.
- Added php-config --lib-dir and --lib-embed options for PHP embed SAPI.
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
directory anymore.
- Autoconf macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore.
- Autoconf macro PHP_EVAL_LIBLINE got a new 3rd argument to override the
ext_shared checks.
- Autoconf macro PHP_SETUP_LIBXML doesn't define the redundant HAVE_LIBXML
symbol anymore and requires at least libxml2 2.9.4.
- Autoconf macro PHP_SETUP_ICONV doesn't define the HAVE_ICONV symbol
anymore.
- Autoconf macro PHP_AP_EXTRACT_VERSION is obsolete (use the
'apxs -q HTTPD_VERSION').
- Autoconf macro PHP_OUTPUT is obsolete (use AC_CONFIG_FILES).
- Autoconf macro PHP_TEST_BUILD is obsolete (use AC_* macros).
- Autoconf macro PHP_BUILD_THREAD_SAFE is obsolete (set enable_zts manually).
- Autoconf macro PHP_DEF_HAVE is obsolete (use AC_DEFINE).
- Autoconf macro PHP_PROG_SETUP now accepts an argument to set the minimum
required PHP version during the build.
- Autoconf macro PHP_INSTALL_HEADERS arguments can now be also
blank-or-newline-separated lists instead of only separated with whitespace
or backslash-then-newline.
- Autoconf macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
blank-or-newline-separated separated list.
- Autoconf macros PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
PHP_SELECT_SAPI now have the source files and flags arguments normalized so
the list of items can be passed as a blank-or-newline-separated list.
- Autoconf macro PHP_ADD_INCLUDE now takes also a blank-or-newline-separated
list of include directories instead of a single directory. The "prepend"
argument is validated at Autoconf compile time.
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS macro have been removed.
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and
PGSQL_LIBS environment variables. When a directory argument is provided to
configure options (--with-pgsql=DIR or --with-pdo-pgsql=DIR), it will be
used instead of the pkg-config search.
- Added pkg-config support to find unixODBC and iODBC for the pdo_odbc
extension.
- Added pkg-config support to find GNU MP library. As a fallback default
system paths are searched. When a directory argument is provided
(--with-gmp=DIR), it will be used instead of the pkg-config.
- Added optional pkg-config support to find NET-SNMP library. As a fallback
net-snmp-config utility is used like before.
- Removed BC enable_pear variable check due to --enable-pear configure option
once used (use with_pear variable name).
- Cache variables synced to php_cv_* naming scheme. If you use them for
advanced cross-compilation, these were renamed:
- ac_cv_copy_file_range -> php_cv_func_copy_file_range
- ac_cv_flush_io -> php_cv_have_flush_io
- ac_cv_func_getaddrinfo -> php_cv_func_getaddrinfo
- ac_cv_have_broken_gcc_strlen_opt -> php_cv_have_broken_gcc_strlen_opt
- ac_cv_have_pcre2_jit -> php_cv_have_pcre2_jit
- ac_cv_pread -> php_cv_func_pread
- ac_cv_pwrite -> php_cv_func_pwrite
- ac_cv_syscall_shadow_stack_exists -> php_cv_have_shadow_stack_syscall
- ac_cv_time_r_type -> php_cv_time_r_type
- ac_cv_write_stdout -> php_cv_have_write_stdout
and all other checks wrapped with their belonging cache variables (see *.m4
source files for details).
c. Windows build system changes
- The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19,
--enable-apache2-2handler have been removed.
- The configure option --enable-apache2-4handler is now an alias for the
preferred --enable-apache2handler.
- Added Bison flag '-Wall' when generating lexer files as done in *nix build
system.
- HAVE_WIN32_NATIVE_THREAD, USE_WIN32_NATIVE_THREAD, ENABLE_THREADS symbols
in ext/mbstring/libmbfl removed.
- FIBER_ASSEMBLER and FIBER_ASM_ARCH Makefile variables removed in favor of
PHP_ASSEMBLER and FIBER_ASM_ABI.
- HAVE_PHP_SOAP symbol renamed to HAVE_SOAP.
- Unused symbols CONFIGURATION_FILE_PATH, DISCARD_PATH, HAVE_ERRMSG_H,
HAVE_REGCOMP, HAVE_RINT, NEED_ISBLANK, PHP_URL_FOPEN, REGEX, HSREGEX,
USE_CONFIG_FILE have been removed.
- The HAVE_OPENSSL symbol has been removed.
- The HAVE_OPENSSL_EXT symbol is now consistently defined to value 1 whether
the openssl extension is available either as shared or built statically.
- Added configure option --enable-phpdbg-debug to build phpdbg in debug mode.
- The win32/build/libs_version.txt file has been removed.
- MSVC builds now use the new preprocessor (/Zc:preprocessor).
- The CHECK_HEADER_ADD_INCLUDE function now consistently defines preprocessor
macros HAVE_<header>_H either to value 1 or leaves them undefined to match
the Autotools headers checks.
========================
3. Module changes
========================
a. ext/dom
- dom_read_t and dom_write_t now expect the function to return zend_result
instead of int.
- The macros DOM_NO_ARGS() and DOM_NOT_IMPLEMENTED() have been removed.
- New public APIs are available to handle callbacks from XPath, see
xpath_callbacks.h.
- Added public APIs to manipulate namespace data, see namespace_compat.h.
- php_dom_create_object() now no longer accepts a NULL obj argument.
- Removed the `ret` argument from the DOM_RET_OBJ macro, use the return
value instead.
- Removed DOM_XMLNS_NAMESPACE from xml_common.h. Use DOM_XMLNS_NS_URI
from namespace_compat.h instead.
- Added php_dom_get_ns_mapper(), php_dom_next_in_tree_order(),
php_dom_follow_spec_doc_ref(), and php_dom_follow_spec_doc_ref().
b. ext/random
- The macro RAND_RANGE_BADSCALING() has been removed. The implementation
should either be inlined and undefined behavior fixed or it should be
replaced by a non-biased scaler.
- The php_srand() and php_rand() functions have been removed. These were
slim wrappers around the corresponding php_mt_srand() and php_mt_rand()
function since PHP 7.1, but using zend_long instead of uint32_t as their
input/output types. This made their behavior incompatible between 32-bit
and 64-bit builds of PHP. Users of these functions are encouraged to
migrate to one of the more modern engines provided since PHP 8.2. If that
is not possible, due to backwards compatibility requirements, then the
php_mt_srand() and php_mt_rand() functions should be called directly and
the values appropriately casted.
- The PHP_RAND_MAX and RAND_MAX constants corresponding to the removed
php_rand() have also been removed.
- The generate member of a php_random_algo is now expected to return
the new php_random_result struct, replacing the last_generated_size
member of the php_random_status struct and the generate_size member of
the php_random_algo struct.
- The php_random_status struct has been removed, since the previous change
reduced it to a single void* member containing the actual state, resulting
in needless indirection. Functions taking a php_random_algo struct pointer
and a php_random_status struct pointer as separate parameters now take a
single php_random_algo_with_state struct by value, making it easier to
pass around the state with its associated algorithm and thus reducing
the chance for mistakes.
- The seed member of a php_random_algo has been removed. As a replacement
engine-specific seeding functions are now exposed. This change allows
users to better take engine-specific behavior into account. As an example
Mt19937 ignored the upper half of the seed parameter of the generic
seeding function.
- The CSPRNG API (php_random_(bytes|int)_*) is now provided by the new
and much smaller php_random_csprng.h header. The new header is included
in php_random.h for compatibility with existing users.
- A new php_random_generate_fallback_seed() function has been added as a
replacement for the generically named GENERATE_SEED(). The internal
implementation has been improved to generate better seeds, however any
users should use the opportunity to verify that seeding is first
attempted using the CSPRNG for better output size flexibility.
- The standalone combined_lcg engine has been removed, as the lcg_value()
userland function is deprecated and as the engine is unable to return
unbiased integer values. The internal php_combined_lcg() function remains
available for now.
c. ext/xsl
- The function php_xsl_create_object() was removed as it was not used
nor exported.
d. ext/libxml
- Added php_libxml_pretend_ctx_error_ex() to emit errors as if they had come
from libxml.
- Added php_libxml_error_handler_va() to pass libxml errors, and
corresponding php_libxml_error_level enum.
- Removed the "properties" HashTable field from php_libxml_node_object.
- Added a way to attached private data to a php_libxml_ref_obj.
- Added a way to fix a class type onto php_libxml_ref_obj.
- Added a way to record quirks mode in php_libxml_ref_obj.
- Added php_libxml_uses_internal_errors().
- Added a way to override document handlers (e.g. serialization) with
php_libxml_document_handlers.
- Changed the refcount fields from int to unsigned int.
e. ext/date
- Added the php_format_date_ex() API to format instances of php_date_obj.
- Added the php_date_initialize_from_ts_long() and
php_date_initialize_from_ts_double() to initialize a php_date_obj with
the given unix timestamp using GMT +00:00.
f. ext/pcre
- php_pcre_match_impl() now no longer has a use_flags argument.
When flags should be ignored, pass 0 to the flags argument.
- php_pcre_match_impl() and pcre_get_compiled_regex_cache_ex() now use
proper boolean argument types instead of integer types.
- pcre_get_compiled_regex_cache_ex() now provides an option to collect extra
options (from modifiers used in the expression, for example), and calls
pcre2_set_compile_extra_options() with those options.
- Removed per-request cache, the cache is now always per process or
per thread depending on whether you use NTS or ZTS.
This was removed due to fundamental ordering issues between destructors.
g. ext/standard
- Added the php_base64_encode_ex() API with flag parameters, value can be
PHP_BASE64_NO_PADDING to encode without the padding character '='.
- The php_escape_shell_cmd() now takes a zend_string* instead of a char*
Moreover, providing it with a binary safe string is the responsibility of
the caller now.
- The php_escape_shell_arg() now takes a zend_string* instead of a char*
Moreover, providing it with a binary safe string is the responsibility of
the caller now.
- The php_info_html_esc() function has been removed, use
php_escape_html_entities() with ENT_QUOTES directly instead.
- The deprecated php_uint32 and php_int32 typedefs have been removed from
ext/standard/basic_functions.h. Use the standard uint32_t and int32_t
types instead.
- The php_strtoupper(), php_string_toupper(), php_strtolower(), and
php_string_tolower() functions has been removed, use zend_str_toupper(),
zend_string_toupper(), zend_str_tolower(), and zend_string_tolower()
respectively instead.
- The php_replace_controlchars_ex() function is no longer exposed.
h. ext/session
- Added the php_get_session_status() API to get the session status, which is
equivalent to reading PS(session_status) but works with shared objects too.
- Added the php_get_session_var_str() API to set a session variable without
needing to create a zend_string.
- The ext/session/php_session.h doesn't transitively include the
ext/hash/php_hash.h header anymore.
i. ext/xml
- Made the expat compatibility wrapper XML_GetCurrentByteIndex return a long
instead of an int. This corresponds to the XML_Index type when
XML_LARGE_SIZE is not used in expat.
========================
4. OpCode changes
========================
* DO_ICALL, DO_FCALL, and DO_FCALL_BY_NAME now call zend_interrupt_function
while the internal frame is still on the stack. This means interrupt handlers
will now see the internal call. If your interrupt handler does something like
switching EG(current_execute_data), it should not do so if an internal func
is on top.
* New FRAMELESS_ICALL_[0,3] opcodes for faster internal function calls have been
added. These opcodes don't create a stack frame, but pass arguments via opcode
operands. They only work for functions that are known at compile-time, and
that provide a frameless handler (search for usages of the
ZEND_FRAMELESS_FUNCTION macro).
* CREATE_GENERATOR now initializes the generator with opline pointing to the
CREATE_GENERATOR op (before, opline was set to the next op).
* YIELD and YIELD_FROM do not increment the opline anymore.
* The EXIT opcode has been removed as exit is now implemented as a function.
========================
5. SAPI changes
========================