2022-08-30 23:17:15 +08:00
|
|
|
PHP 8.3 INTERNALS UPGRADE NOTES
|
2010-08-30 18:26:31 +08:00
|
|
|
|
|
|
|
1. Internal API changes
|
2010-09-17 16:42:12 +08:00
|
|
|
|
2010-11-18 18:43:01 +08:00
|
|
|
2. Build system changes
|
|
|
|
|
2015-07-03 17:46:30 +08:00
|
|
|
3. Module changes
|
2010-11-18 18:43:01 +08:00
|
|
|
|
2021-12-10 01:15:59 +08:00
|
|
|
4. OpCode changes
|
|
|
|
|
2022-06-08 20:23:41 +08:00
|
|
|
5. SAPI changes
|
|
|
|
|
2010-08-30 18:26:31 +08:00
|
|
|
========================
|
|
|
|
1. Internal API changes
|
|
|
|
========================
|
|
|
|
|
2022-09-14 17:19:06 +08:00
|
|
|
* zend_class_entry now possesses a default_object_handlers field, which
|
|
|
|
provides a default object handler when create_object() is not overriding it.
|
2022-12-17 01:03:48 +08:00
|
|
|
* Custom Fiber implementations have to initialize EG(stack_limit) and
|
|
|
|
EG(stack_base).
|
|
|
|
* EG(opline_before_exception) may now be null if the VM throws an exception
|
|
|
|
before executing any opline.
|
2023-01-04 23:36:26 +08:00
|
|
|
* Many C header files have been cleaned up and include dependencies
|
|
|
|
have been reduced. Many headers which used to be always included by
|
|
|
|
Zend headers (e.g. "errno.h") are no longer implied, and this may
|
|
|
|
break the build of third-party extensions which relied on this
|
|
|
|
implementation detail. Those extensions may need to add the missing
|
|
|
|
#include lines.
|
2023-01-13 19:51:15 +08:00
|
|
|
* Since version 8, PHP requires a C99 compiler. Configure-time checks
|
|
|
|
for C99 features have been removed and therefore macro definitions
|
|
|
|
from php_config.h have disappeared. Do not use those feature
|
|
|
|
macros.
|
2023-02-22 18:47:32 +08:00
|
|
|
* Internal class aliases created during request time can now exist in
|
|
|
|
the class table. zend_register_class_alias_ex() will not increase
|
|
|
|
the refcount for class aliases and the cleanup function takes this
|
|
|
|
into account.
|
2023-02-19 16:29:15 +08:00
|
|
|
* The return types of the following functions have been changed from
|
|
|
|
`bool` to `zend_result`:
|
|
|
|
- zend_fiber_init_context()
|
2023-03-07 23:40:17 +08:00
|
|
|
* The fast_add_function() has been removed, use add_function() that will
|
|
|
|
call the static inline add_function_fast() instead.
|
2023-03-23 02:26:42 +08:00
|
|
|
* The order of members of zend_op_array, zend_ssa_var, zend_ssa_var_info,
|
|
|
|
zend_executor_globals and php_core_globals have changed to improve
|
|
|
|
struct packing which reduces their size.
|
2023-04-05 00:57:28 +08:00
|
|
|
* Many calls to zend_assign_to_variable have been replaced with
|
|
|
|
zend_assign_to_variable_ex which allows delaying the releasing of the old
|
|
|
|
variable value. This avoids side-effects through destructors between the
|
|
|
|
assignment of the variable and the assignment to the result zval in the VM
|
|
|
|
(i.e. it may free the new value). See GH-10168 for details.
|
2023-04-19 22:59:20 +08:00
|
|
|
* The return types of the following functions were changed from int to
|
|
|
|
zend_result:
|
|
|
|
- open_file_for_scanning
|
|
|
|
- php_rfc1867_callback
|
|
|
|
- virtual_chdir
|
|
|
|
- zend_execute_scripts
|
|
|
|
- zend_get_module_started
|
|
|
|
- zend_handle_undef_args
|
|
|
|
- zend_list_delete
|
|
|
|
- zend_multibyte_parse_encoding_list
|
|
|
|
- zend_multibyte_set_internal_encoding
|
|
|
|
- zend_parse_ini_file
|
|
|
|
- zend_parse_ini_string
|
|
|
|
- zend_set_user_opcode_handler
|
|
|
|
- zend_ssa_inference
|
2023-05-04 00:46:31 +08:00
|
|
|
* Removed unused macros PHP_FNV1_32A_INIT and PHP_FNV1A_64_INIT. See GH-11114.
|
2023-07-16 18:34:28 +08:00
|
|
|
* ext/standard/hrtime.h was moved to Zend/zend_hrtime.h
|
|
|
|
* The prefix of the PHP_HRTIME_ macros was changed to ZEND_HRTIME_
|
|
|
|
* The HRTIME_AVAILABLE macro was renamed to ZEND_HRTIME_AVAILABLE
|
|
|
|
* The php_hrtime_current() function was renamed to zend_hrtime()
|
2023-07-02 20:35:43 +08:00
|
|
|
* _php_stream_dirent now has an extra d_type field that is used to store the
|
|
|
|
directory entry type. This can be used to avoid additional stat calls for
|
|
|
|
types when the type is already known.
|
2023-10-18 17:25:12 +08:00
|
|
|
* The misspelled ZEND_CGG_DIAGNOSTIC_IGNORED_(START|END) macros are deprecated.
|
|
|
|
Use ZEND_DIAGNOSTIC_IGNORED_(START|END) instead. These macros now also support
|
|
|
|
Clang.
|
2021-09-24 15:38:08 +08:00
|
|
|
|
2010-11-18 18:43:01 +08:00
|
|
|
========================
|
|
|
|
2. Build system changes
|
|
|
|
========================
|
2021-09-01 01:13:49 +08:00
|
|
|
|
2023-07-19 18:14:42 +08:00
|
|
|
* PHP_EXTRA_VERSION can be passed to configure script to control custom PHP
|
|
|
|
build versions: ./configure PHP_EXTRA_VERSION="-acme"
|
|
|
|
|
2023-07-07 17:07:22 +08:00
|
|
|
* LDFLAGS are not unset anymore allowing them to be adjusted e.g.
|
|
|
|
LDFLAGS="..." ./configure
|
|
|
|
|
2023-01-21 07:39:57 +08:00
|
|
|
* Removed the HAVE_DEV_URANDOM compile time check. HAVE_DEV_URANDOM will
|
|
|
|
now never be defined. Any checks relying on HAVE_DEV_URANDOM should be
|
|
|
|
removed. Even with HAVE_DEV_URANDOM it was not guaranteed that
|
|
|
|
/dev/urandom is actually available at run time and thus a runtime
|
|
|
|
check needs to happen in all cases.
|
|
|
|
|
2015-01-26 05:14:40 +08:00
|
|
|
========================
|
|
|
|
3. Module changes
|
|
|
|
========================
|
2020-12-13 23:50:22 +08:00
|
|
|
|
2022-10-08 21:52:19 +08:00
|
|
|
a. ext/json
|
|
|
|
- A new function php_json_validate_ex has been added to check if the
|
|
|
|
provided C string is valid for the given depth and options.
|
2022-12-17 01:03:48 +08:00
|
|
|
|
2023-01-16 00:10:14 +08:00
|
|
|
b. ext/standard
|
|
|
|
- The PHPAPI php_url_encode_hash_ex() function has had its signature change
|
|
|
|
from:
|
|
|
|
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
|
|
|
|
const char *num_prefix, size_t num_prefix_len,
|
|
|
|
const char *key_prefix, size_t key_prefix_len,
|
|
|
|
const char *key_suffix, size_t key_suffix_len,
|
|
|
|
zval *type, const char *arg_sep, int enc_type);
|
|
|
|
to:
|
|
|
|
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
|
|
|
|
const char *num_prefix, size_t num_prefix_len,
|
|
|
|
const zend_string *key_prefix,
|
|
|
|
zval *type, const zend_string *arg_sep, int enc_type);
|
|
|
|
The change to use zend_string prevent the computation of the arg_sep
|
|
|
|
length at each call. The key_suffix parameter was dropped as it was a
|
|
|
|
constant value and depended on the key_prefix parameter to not be NULL.
|
|
|
|
|
2023-01-17 19:46:34 +08:00
|
|
|
c. ext/mysqlnd
|
|
|
|
- The function mysqlnd_shutdown and its corresponding internal methods
|
|
|
|
mysqlnd_command::shutdown & mysqlnd_conn_data::shutdown have been removed.
|
|
|
|
These functions are deprecated by MySQL in favour of SHUTDOWN SQL statement.
|
|
|
|
|
2023-01-18 22:28:19 +08:00
|
|
|
d. ext/pcre
|
|
|
|
- The function pcre_get_compiled_regex_ex has been removed.
|
|
|
|
Use pcre_get_compiled_regex instead.
|
|
|
|
|
2023-03-02 01:58:17 +08:00
|
|
|
e. ext/spl
|
|
|
|
- The PHPAPI spl_iterator_apply() function now returns zend_result instead of int.
|
|
|
|
There are no functional changes.
|
2023-07-02 20:34:28 +08:00
|
|
|
- The field _spl_filesystem_object->is_recursive has been removed.
|
2023-03-02 01:58:17 +08:00
|
|
|
|
2023-05-30 05:14:27 +08:00
|
|
|
f. ext/dom
|
|
|
|
- A new function dom_get_doc_props_read_only() is added to gather the document
|
|
|
|
properties in a read-only way. This function avoids allocation when there are
|
|
|
|
no document properties changed yet.
|
Implement iteration cache, item cache and length cache for node list iteration (#11330)
* Implement iteration cache, item cache and length cache for node list iteration
The current implementation follows the spec requirement that the list
must be "live". This means that changes in the document must be
reflected in the existing node lists without requiring the user to
refetch the node list.
The consequence is that getting any item, or the length of the list,
always starts searching from the root element of the node list. This
results in O(n) time to get any item or the length. If there's a for
loop over the node list, this means the iterations will take O(n²) time
in total. This causes real-world performance issues with potential for
downtime (see GH-11308 and its references for details).
We fix this by introducing a caching strategy. We cache the last
iterated object in the iterator, the last requested item in the node
list, and the last length computation. To invalidate the cache, we
simply count the number of modifications made to the containing
document. If the modification number does not match what the number was
during caching, we know the document has been modified and the cache is
invalid. If this ever overflows, we saturate the modification number and
don't do any caching anymore. Note that we don't check for overflow on
64-bit systems because it would take hundreds of years to overflow.
Fixes GH-11308.
2023-06-03 06:13:14 +08:00
|
|
|
- The node list returned by DOMNode::getElementsByTagName() and
|
2023-06-27 03:59:04 +08:00
|
|
|
DOMNode::getElementsByTagNameNS() now caches the length and the last requested item.
|
|
|
|
This means that the length and the last requested item are not recalculated
|
|
|
|
when the node list is iterated over multiple times.
|
|
|
|
If you do not use the internal PHP dom APIs to modify the document, you need to
|
|
|
|
manually invalidate the cache using php_libxml_invalidate_node_list_cache_from_doc().
|
|
|
|
Furthermore, the following internal APIs were added to handle the cache:
|
|
|
|
. php_dom_is_cache_tag_stale_from_doc_ptr()
|
|
|
|
. php_dom_is_cache_tag_stale_from_node()
|
|
|
|
. php_dom_mark_cache_tag_up_to_date_from_node()
|
Implement iteration cache, item cache and length cache for node list iteration (#11330)
* Implement iteration cache, item cache and length cache for node list iteration
The current implementation follows the spec requirement that the list
must be "live". This means that changes in the document must be
reflected in the existing node lists without requiring the user to
refetch the node list.
The consequence is that getting any item, or the length of the list,
always starts searching from the root element of the node list. This
results in O(n) time to get any item or the length. If there's a for
loop over the node list, this means the iterations will take O(n²) time
in total. This causes real-world performance issues with potential for
downtime (see GH-11308 and its references for details).
We fix this by introducing a caching strategy. We cache the last
iterated object in the iterator, the last requested item in the node
list, and the last length computation. To invalidate the cache, we
simply count the number of modifications made to the containing
document. If the modification number does not match what the number was
during caching, we know the document has been modified and the cache is
invalid. If this ever overflows, we saturate the modification number and
don't do any caching anymore. Note that we don't check for overflow on
64-bit systems because it would take hundreds of years to overflow.
Fixes GH-11308.
2023-06-03 06:13:14 +08:00
|
|
|
- The function dom_get_elements_by_tag_name_ns_raw() has an additional parameter to indicate
|
|
|
|
the base node of the node list. This function also no longer accepts -1 as the index argument.
|
|
|
|
- The function dom_namednode_iter() has additional arguments to avoid recomputing the length of
|
|
|
|
the strings.
|
2023-06-05 20:57:41 +08:00
|
|
|
- The functions dom_parent_node_prepend(), dom_parent_node_append(), dom_parent_node_after(), and
|
|
|
|
dom_parent_node_before() now use an uint32_t argument for the number of nodes instead of int.
|
2023-06-27 03:59:04 +08:00
|
|
|
- There is now a helper function php_dom_get_content_into_zval() to get the contents of a node.
|
|
|
|
This avoids allocation if possible.
|
2023-08-06 20:40:54 +08:00
|
|
|
- The function dom_set_old_ns() has been moved into ext/libxml as php_libxml_set_old_ns() and
|
|
|
|
is now publicly exposed as an API.
|
Implement iteration cache, item cache and length cache for node list iteration (#11330)
* Implement iteration cache, item cache and length cache for node list iteration
The current implementation follows the spec requirement that the list
must be "live". This means that changes in the document must be
reflected in the existing node lists without requiring the user to
refetch the node list.
The consequence is that getting any item, or the length of the list,
always starts searching from the root element of the node list. This
results in O(n) time to get any item or the length. If there's a for
loop over the node list, this means the iterations will take O(n²) time
in total. This causes real-world performance issues with potential for
downtime (see GH-11308 and its references for details).
We fix this by introducing a caching strategy. We cache the last
iterated object in the iterator, the last requested item in the node
list, and the last length computation. To invalidate the cache, we
simply count the number of modifications made to the containing
document. If the modification number does not match what the number was
during caching, we know the document has been modified and the cache is
invalid. If this ever overflows, we saturate the modification number and
don't do any caching anymore. Note that we don't check for overflow on
64-bit systems because it would take hundreds of years to overflow.
Fixes GH-11308.
2023-06-03 06:13:14 +08:00
|
|
|
|
|
|
|
g. ext/libxml
|
|
|
|
- Two new functions: php_libxml_invalidate_node_list_cache_from_doc() and
|
|
|
|
php_libxml_invalidate_node_list_cache() were added to invalidate the cache of a node list.
|
2023-05-30 05:14:27 +08:00
|
|
|
|
2021-12-10 01:15:59 +08:00
|
|
|
========================
|
|
|
|
4. OpCode changes
|
|
|
|
========================
|
|
|
|
|
2022-06-08 20:23:41 +08:00
|
|
|
========================
|
|
|
|
5. SAPI changes
|
|
|
|
========================
|
2022-12-17 01:03:48 +08:00
|
|
|
|
|
|
|
* SAPIs that may execute in alternative stacks have to set EG(stack_limit) and
|
|
|
|
EG(stack_base)
|