xref: /PHP-8.2/UPGRADING.INTERNALS (revision 25cdb3b8)
1PHP 8.2 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* Removed zend_binary_zval_str(n)casecmp() APIs. These were thin wrappers
18  around zend_binary_str(n)casecmp_l() -- rather than
19  zend_binary_str(n)casecmp() as one would expect. Call the appropriate
20  wrapped function directly instead.
21* Removed the (ZEND_)WRONG_PARAM_COUNT_WITH_RETVAL() macros.
22* php_stristr() no longer lowercases the haystack and needle as a side effect.
23  Call zend_str_tolower() yourself if necessary. You no longer need to copy
24  the haystack and needle before passing them to php_stristr().
25* zend_register_module_ex() no longer copies the module entry.
26* The main/php_stdint.h header has been removed.
27  Include the standard <inttypes.h> and/or <stdint.h> headers instead.
28  Replace usage of u_char by the standard C99 uint8_t type.
29* A new ZEND_THREEWAY_COMPARE() macro has been introduced which does a
30  three-way comparison of two integers and returns -1, 0 or 1 if the LHS is
31  smaller, equal or larger than the RHS
32* Deprecated zend_atoi() and zend_atol(). Use ZEND_STRTOL() for general purpose
33  string to long conversion, or a variant of zend_ini_parse_quantity() for
34  parsing ini quantities.
35* The return types of the following object handlers has changed from int to zend_result
36  - zend_object_cast_t
37  - zend_object_count_elements_t
38  - zend_object_get_closure_t
39  - zend_object_do_operation_t
40* Added a new zero_position argument to php_stream_fopen_from_fd_rel to reflect
41  if this a newly created file so the current file offset needs not to be checked.
42* Added smart_str_trim_to_size(). The function trims the memory allocated for the
43  string. This can considerably reduce the memory footprint of strings smaller
44  than approximately 4096 bytes.
45* smart_str_extract() and the spprintf family of functions now use
46  smart_str_trim_to_size() before returning the string.
47* It is recommended to use smart_str_extract() or smart_str_trim_to_size() when
48  using the smart_str API.
49* zend_is_callable_ex, and functions which call it such as zend_is_callable and
50  zend_fcall_info_init, will issue deprecation notices if passed values which
51  are deprecated (see main UPGRADING notes). To suppress the notice, e.g. to
52  avoid duplicates when processing the same value multiple times, pass or add
53  IS_CALLABLE_SUPPRESS_DEPRECATIONS to the check_flags parameter.
54* Registered zend_observer_fcall_init handlers are now also called for internal functions.
55* The pestrdup and pestrndup macros and zend_strndup function are now also infallible
56  for persistent strings, so checking for NULL is no longer necessary.
57* The CHECK_NULL_PATH and CHECK_ZVAL_NULL_PATH macros are now wrappers using
58  the new inline functions: bool zend_str_has_nul_byte(const zend_string *str)
59  and zend_char_has_nul_byte(const char *s, size_t known_length)
60* Added zend_enum_get_case_by_value() function, which provides an internal API
61  similiar to BackedEnum::from() and BackedEnum::tryFrom().
62
63========================
642. Build system changes
65========================
66
67* The build system now requires PHP 7.4.0 at least. Previously PHP 7.1 was
68  required.
69* Unsupported libxml2 2.10.0 symbols are no longer exported on Windows.
70* Identifier names for namespaced functions generated from stub files through
71  gen_stub.php have been changed. This requires that namespaced functions
72  should be declared via the PHP_FUNCTION macro by using the fully qualified
73  function name (whereas each part is separated by "_") instead of just the
74  function name itself.
75
76========================
773. Module changes
78========================
79
80  a. ext/standard
81    - The PHP APIs string_natural_compare_function_ex(),
82      string_natural_case_compare_function(), and string_natural_compare_function()
83      have been removed. They always returned SUCCESS and were a wrapper around
84      strnatcmp_ex(). Use strnatcmp_ex() directly instead.
85    - The PHP API php_fgetcsv() now returns a HashTable* instead of having an in-out
86      zval parameter.
87      It now returns NULL on an empty line instead of [null].
88      A new function php_bc_fgetcsv_empty_line() has been added to get a HashTable* which
89      represents [null].
90  b. ext/pdo
91    - pdo_raise_impl_error()'s parameter sqlstate has been changed from
92      const char * to pdo_error_type (aka char [6]).
93
94========================
954. OpCode changes
96========================
97
98* The ZEND_INIT_FCALL opcode now asserts that the function exists in the symbol
99  table as the function's existence is checked at compile time.
100  For extensions modifying the function symbol table, setting
101  CG(compiler_options) |= ZEND_COMPILE_IGNORE_USER_FUNCTIONS | ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS;
102  will produce ZEND_INIT_FCALL_BY_NAME opcodes instead which check for the
103  existence of the function at runtime.
104
105========================
1065. SAPI changes
107========================
108
109 * The signature of php_module_startup() has changed from
110   int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint32_t num_additional_modules)
111   to
112   zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
113   as only one additional module was ever provided.
114