1PHP 8.4 INTERNALS UPGRADE NOTES 2 31. Internal API changes 4 52. Build system changes 6 73. Module changes 8 94. OpCode changes 10 115. SAPI changes 12 13======================== 141. Internal API changes 15======================== 16 17* zend_register_module_ex() now takes an additional int module_type argument. 18 This function will also assign the module number and type, there is no need 19 to do this at the call site anymore. Writing the handle should happen after 20 successful registration. 21 22* ZPP now accepts a F or Z_PARAM_FUNC_NO_TRAMPOLINE_FREE type check. 23 This is identical to the 'f' or Z_PARAM_FUNC type check, except the FCC is 24 always initialized because it doesn't free trampolines. 25 Trampolines MUST be freed using zend_release_fcall_info_cache() or consumed. 26 Z_PARAM_FUNC_EX2 was added as well with the same arguments as Z_PARAM_FUNC_EX 27 plus an additional argument free_trampoline. 28 29* The zend_object_iterator_funcs valid member has changed its signature from 30 int(*)(zend_object_iterator *) to zend_result(*)(zend_object_iterator *) to 31 be more in line with what callbacks are returning. 32 33* The backwards compatibility headers ext/standard/{php_lcg.h,php_mt_rand.h, 34 php_rand.h,php_random.h} have been removed. Include ext/random/php_random.h 35 directly. 36 37* The zend_*printf family of functions now supports the "%S" modifier to print 38 out zend_string*. This won't cut off the string if it embeds a NUL byte. 39 40* The inet_aton() and win32/inet.h have been removed. Use platform-agnostic 41 inet_pton() from arpa/inet.h or ws2tcpip.h on Windows. 42 43* zend_mm_set_custom_debug_handlers() has been removed from ZendMM, use 44 zend_mm_set_custom_handlers() instead which now supports DEBUG builds 45 46* zend_mm_set_custom_handlers() has changed its signature from 47 void()(zend_mm_heap *heap, 48 void* (*_malloc)(size_t), 49 void (*_free)(void*), 50 void* (*_realloc)(void*, size_t)) 51 to 52 void()(zend_mm_heap *heap, 53 void* (*_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), 54 void (*_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), 55 void* (*_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)) 56 57* zend_mm_get_custom_handlers() has changed its signature from 58 void()(zend_mm_heap *heap, 59 void* (**_malloc)(size_t), 60 void (**_free)(void*), 61 void* (**_realloc)(void*, size_t)) 62 to 63 void()(zend_mm_heap *heap, 64 void* (**_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), 65 void (**_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), 66 void* (**_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)) 67 68* __zend_malloc() has changed their signature from 69 void(*)(size_t) to 70 void(*)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) 71 72* __zend_calloc() has changed their signature from 73 void(*)(size_t, size_t) to 74 void(*)(size_t, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) 75 76* __zend_realloc() has changed their signature from 77 void(*)(void *, size_t) to 78 void(*)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) 79 80* zend_observer_remove_begin_handler() and zend_observer_remove_end_handler() 81 got each a new parameter returning an observer which must be called, if the 82 removal happened during observer execution. 83 84 85======================== 862. Build system changes 87======================== 88 89 a. Abstract 90 - The configure option --with-imap has been removed. 91 - The configure option --with-mhash emits deprecation warning. 92 - The configure option --with-pdo-oci has been removed. 93 - The configure option --with-pspell has been removed. 94 - Symbol SIZEOF_SHORT removed (size of 2 on 32-bit and 64-bit platforms). 95 - Symbol DBA_CDB_MAKE removed in ext/dba. 96 - Symbol HAVE_LIBM has been removed. 97 - Symbol HAVE_INET_ATON has been removed. 98 - The Zend/zend_istdiostream.h header has been removed. 99 100 b. Unix build system changes 101 - The configure option --with-imap-ssl has been removed. 102 - The configure option --with-oci8 has been removed. 103 - The configure option --with-zlib-dir has been removed. 104 - The configure option --with-kerberos has been removed. 105 - COOKIE_IO_FUNCTIONS_T symbol has been removed (use cookie_io_functions_t). 106 - HAVE_SOCKADDR_UN_SUN_LEN symbol renamed to HAVE_STRUCT_SOCKADDR_UN_SUN_LEN. 107 - HAVE_UTSNAME_DOMAINNAME symbol renamed to HAVE_STRUCT_UTSNAME_DOMAINNAME. 108 - PHP_CHECK_IN_ADDR_T M4 macro and 'in_addr_t' fallback definition to 'u_int' 109 removed (use AC_CHECK_TYPES Autoconf macro instead). 110 - HAVE_ODBC2 symbol has been removed in ext/odbc. 111 - Removed linking with obsolete dnet_stub library in ext/pdo_dblib. 112 - Removed checking and linking with obsolete libbind for some functions. 113 - Symbol HAVE_JSON has been removed (ext/json is always available since PHP 114 8.0). 115 - Symbol DARWIN has been removed (use __APPLE__ to target Darwin systems). 116 - Symbol MISSING_FCLOSE_DECL and M4 macro PHP_MISSING_FCLOSE_DECL removed. 117 - Symbol HAVE_BSD_ICONV has been removed. 118 - Symbol ZEND_FIBER_ASM has been removed. 119 - Symbols HAVE_DLOPEN and HAVE_DLSYM have been removed. 120 - Symbol HAVE_MYSQL has been removed. 121 - M4 macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and config.h). 122 - M4 macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH). 123 - M4 macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES). 124 - M4 macro PHP_SOCKADDR_CHECKS has been removed (use AC_CHECK_TYPES and 125 AC_CHECK_MEMBERS). 126 - M4 macro PHP_CHECK_GCC_ARG has been removed since PHP 8.0 (use 127 AX_CHECK_COMPILE_FLAG). 128 - Added php-config --lib-dir and --lib-embed options for PHP embed SAPI. 129 130 c. Windows build system changes 131 - The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have 132 been removed. 133 - Added Bison flag '-Wall' when generating lexer files as done in *nix build 134 system. 135 - HAVE_WIN32_NATIVE_THREAD, USE_WIN32_NATIVE_THREAD, ENABLE_THREADS symbols 136 in ext/mbstring/libmbfl removed. 137 - FIBER_ASSEMBLER and FIBER_ASM_ARCH Makefile variables removed in favor of 138 PHP_ASSEMBLER and FIBER_ASM_ABI. 139 - HAVE_PHP_SOAP symbol renamed to HAVE_SOAP. 140 - Unused symbols CONFIGURATION_FILE_PATH, DISCARD_PATH, HAVE_ERRMSG_H, 141 HAVE_REGCOMP, HAVE_RINT, NEED_ISBLANK, PHP_URL_FOPEN, REGEX, HSREGEX, 142 USE_CONFIG_FILE have been removed. 143 144======================== 1453. Module changes 146======================== 147 148 a. ext/dom 149 - dom_read_t and dom_write_t now expect the function to return zend_result 150 instead of int. 151 - The macros DOM_NO_ARGS() and DOM_NOT_IMPLEMENTED() have been removed. 152 - New public APIs are available to handle callbacks from XPath, see 153 xpath_callbacks.h. 154 - Added public APIs to manipulate namespace data, see namespace_compat.h. 155 - php_dom_create_object() now no longer accepts a NULL obj argument. 156 - Removed the `ret` argument from the DOM_RET_OBJ macro, use the return 157 value instead. 158 - Removed DOM_XMLNS_NAMESPACE from xml_common.h. Use DOM_XMLNS_NS_URI 159 from namespace_compat.h instead. 160 - Added php_dom_get_ns_mapper(), php_dom_next_in_tree_order(), 161 php_dom_follow_spec_doc_ref(), and php_dom_follow_spec_doc_ref(). 162 163 b. ext/random 164 - The macro RAND_RANGE_BADSCALING() has been removed. The implementation 165 should either be inlined and undefined behavior fixed or it should be 166 replaced by a non-biased scaler. 167 - The generate member of a php_random_algo is now expected to return 168 the new php_random_result struct, replacing the last_generated_size 169 member of the php_random_status struct and the generate_size member of 170 the php_random_algo struct. 171 - The php_random_status struct has been removed, since the previous change 172 reduced it to a single void* member containing the actual state, resulting 173 in needless indirection. Functions taking a php_random_algo struct pointer 174 and a php_random_status struct pointer as separate parameters now take a 175 single php_random_algo_with_state struct by value, making it easier to 176 pass around the state with its associated algorithm and thus reducing 177 the chance for mistakes. 178 - The seed member of a php_random_algo has been removed. As a replacement 179 engine-specific seeding functions are now exposed. This change allows 180 users to better take engine-specific behavior into account. As an example 181 Mt19937 ignored the upper half of the seed parameter of the generic 182 seeding function. 183 - The CSPRNG API (php_random_(bytes|int)_*) is now provided by the new 184 and much smaller php_random_csprng.h header. The new header is included 185 in php_random.h for compatibility with existing users. 186 - A new php_random_generate_fallback_seed() function has been added as a 187 replacement for the generically named GENERATE_SEED(). The internal 188 implementation has been improved to generate better seeds, however any 189 users should use the opportunity to verify that seeding is first 190 attempted using the CSPRNG for better output size flexibility. 191 192 c. ext/xsl 193 - The function php_xsl_create_object() was removed as it was not used 194 nor exported. 195 196 d. ext/libxml 197 - Added php_libxml_pretend_ctx_error_ex() to emit errors as if they had come 198 from libxml. 199 - Added php_libxml_error_handler_va() to pass libxml errors, and 200 corresponding php_libxml_error_level enum. 201 - Removed the "properties" HashTable field from php_libxml_node_object. 202 - Added a way to attached private data to a php_libxml_ref_obj. 203 - Added a way to fix a class type onto php_libxml_ref_obj. 204 - Added php_libxml_uses_internal_errors(). 205 206 e. ext/date 207 - Added the php_format_date_ex() API to format instances of php_date_obj. 208 - Added the php_date_initialize_from_ts_long() and 209 php_date_initialize_from_ts_double() to initialize a php_date_obj with 210 the given unix timestamp using GMT +00:00. 211 212 f. ext/pcre 213 - php_pcre_match_impl() now no longer has a use_flags argument. 214 When flags should be ignored, pass 0 to the flags argument. 215 - php_pcre_match_impl() and pcre_get_compiled_regex_cache_ex() now use 216 proper boolean argument types instead of integer types. 217 - pcre_get_compiled_regex_cache_ex() now provides an option to collect extra 218 options (from modifiers used in the expression, for example), and calls 219 pcre2_set_compile_extra_options() with those options. 220 221 g. ext/standard 222 - Added the php_base64_encode_ex() API with flag parameters, value can be 223 PHP_BASE64_NO_PADDING to encode without the padding character '='. 224 225======================== 2264. OpCode changes 227======================== 228 229* New FRAMELESS_ICALL_[0,3] opcodes for faster internal function calls have been 230 added. These opcodes don't create a stack frame, but pass arguments via opcode 231 operands. They only work for functions that are known at compile-time, and 232 that provide a frameless handler (search for usages of the 233 ZEND_FRAMELESS_FUNCTION macro). 234 235======================== 2365. SAPI changes 237======================== 238