php-src/UPGRADING

346 lines
13 KiB
Plaintext
Raw Normal View History

2023-08-29 19:25:46 +00:00
PHP 8.4 UPGRADE NOTES
1. Backward Incompatible Changes
2. New Features
2014-05-01 10:27:38 +00:00
3. Changes in SAPI modules
4. Deprecated Functionality
5. Changed Functions
6. New Functions
7. New Classes and Interfaces
2015-02-10 07:56:18 +00:00
8. Removed Extensions and SAPIs
2014-05-01 10:27:38 +00:00
9. Other Changes to Extensions
10. New Global Constants
11. Changes to INI File Handling
2014-08-22 11:35:07 +00:00
12. Windows Support
13. Other Changes
14. Performance Improvements
2010-03-24 16:23:50 +00:00
========================================
1. Backward Incompatible Changes
2010-03-24 16:23:50 +00:00
========================================
- DOM:
. New methods and constants were added to some DOM classes. If you inherit
from these and you happen to have a method or property with the same name,
you might encounter errors if the declaration is incompatible.
Consult sections 2. New Features and 6. New Functions for a list of
newly implemented methods and constants.
. Some DOM methods previously returned false or a PHP_ERR DOMException if a new
node could not be allocated. They consistently throw an INVALID_STATE_ERR
DOMException now. This situation is extremely unlikely though and probably
will not affect you. As a result DOMImplementation::createDocument() now has
a tentative return type of DOMDocument instead of DOMDocument|false.
- MBString:
. mb_encode_numericentity() and mb_decode_numericentity() now check that
the $map is only composed of integers, if not a ValueError is thrown.
. mb_http_input() now always throws a ValueError if the $type is invalid.
. On invalid strings (those with encoding errors), mb_substr() now interprets
character indices in the same manner as most other mbstring functions. This
means that character indices returned by mb_strpos() can be passed to mb_substr().
. For SJIS-Mac (MacJapanese) strings, character indices passed to mb_substr() now
refer to the indices of the Unicode codepoints which are produced when the string
is converted to Unicode. This is significant because around 40 SJIS-Mac characters
convert to a sequence of multiple Unicode codepoints.
- PDO_DBLIB:
. setAttribute, DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT
have been changed to set value as a bool.
- PDO_FIREBIRD:
. getAttribute, ATTR_AUTOCOMMIT has been changed to get the value as a bool.
- PDO_MYSQL:
. getAttribute, ATTR_AUTOCOMMIT, ATTR_EMULATE_PREPARES, MYSQL_ATTR_DIRECT_QUERY have
been changed to get values as bool.
- PDO_PGSQL:
. The DSN's credentials, when set, are given priority over their PDO
constructor counterparts, being closer to the documentation states.
- PCNTL:
. The functions pcntl_sigprocmask(), pcntl_sigwaitinfo() and
pcntl_sigtimedwait() now throw:
- A ValueError if the $signals array is empty (except for
pcntl_sigprocmask() if the $mode is SIG_SETMASK).
- A TypeError if a value of the $signals array is not an integer
- A ValueError if a value of the $signals array is not a valid signal number
Moreover, those functions now always return false on failure.
In some case previously it could return the value -1.
. The function pcntl_sigprocmask() will also now throw:
- A ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
. The function pcntl_sigtimedwait() will also now throw:
- A ValueError if $seconds is less than 0
- A ValueError if $nanoseconds is less than 0 or greater than 1e9
- A ValueError if both $seconds and $nanoseconds are 0
- SimpleXML:
. Get methods called, or casting to a string on a SimpleXMLElement will no
longer implicitly reset the iterator data, unless explicitly rewound.
For example, casting an element to a string within a foreach loop would
cause an infinite loop because it destroyed the current iterator data.
This is no longer the case as a consequence of the bugfixes for GH-12192,
GH-12208, #55098.
- SPL:
. Out of bounds accesses in SplFixedArray now throw an exception of type
OutOfBoundsException instead of RuntimeException. As OutOfBoundsException
is a child class of RuntimeException, code that uses RuntimeException
continues to function.
- Standard:
. round() now validates the value of the $mode parameter and throws a ValueError
for invalid modes. Previously invalid modes would have been interpreted as
PHP_ROUND_HALF_UP.
2023-11-04 13:54:30 +00:00
. strcspn() with empty $characters now returns the length of the string instead
of incorrectly stopping at the first NUL character. See GH-12592.
- XML:
. The xml_set_*_handler() functions now declare and check for an effective
signature of callable|string|null for the $handler parameters.
Moreover, values of type string that correspond to method names,
of object set with xml_set_object() are now checked to see if the method
exists on the class of the previously passed object.
This means that xml_set_object() must now always be called prior to setting
method names as callables.
Passing an empty string to disable the handler is still allowed,
but not recommended.
- XSL:
. XSLTProcessor::setParameter() will now throw a ValueError when its arguments
contain null bytes. This never actually worked correctly in the first place,
which is why it throws an exception nowadays.
========================================
2. New Features
========================================
- DOM:
. Added constant DOMNode::DOCUMENT_POSITION_DISCONNECTED.
. Added constant DOMNode::DOCUMENT_POSITION_PRECEDING.
. Added constant DOMNode::DOCUMENT_POSITION_FOLLOWING.
. Added constant DOMNode::DOCUMENT_POSITION_CONTAINS.
. Added constant DOMNode::DOCUMENT_POSITION_CONTAINED_BY.
. Added constant DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC.
. Implemented DOM HTML5 parsing and serialization.
RFC: https://wiki.php.net/rfc/domdocument_html5_parser.
This RFC adds the new DOM namespace along with class and constant aliases.
There are two new classes to handle HTML and XML documents:
DOM\HTMLDocument and DOM\XMLDocument.
These classes provide a cleaner API to handle HTML and XML documents.
Furthermore, the DOM\HTMLDocument class implements spec-compliant HTML5
parsing and serialization.
- FPM:
. Flushing headers without a body will now succeed. See GH-12785.
- Phar:
. Added support for the unix timestamp extension for zip archives.
- POSIX:
. Added constant POSIX_SC_CHILD_MAX
. Added constant POSIX_SC_CLK_TCK
- SOAP:
. Added support for clark notation for namespaces in class map.
It is now possible to specify entries in a class map with clark notation
to resolve a type with a specific namespace to a specific class.
For example: '{http://example.com}foo' => 'FooClass'.
. Instances of DateTimeInterface that are passed to xsd:datetime or similar
elements are now serialized as such instead of being serialized as an
empty string.
- XSL:
. It is now possible to use parameters that contain both single and double
quotes.
========================================
2014-05-01 10:27:38 +00:00
3. Changes in SAPI modules
========================================
========================================
2014-05-01 10:27:38 +00:00
4. Deprecated Functionality
========================================
- Date:
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is
deprecated. Use DatePeriod::createFromISO8601String() instead.
- Intl:
. Calling intlcal_set() as well as calling IntlCalendar::set() with
more than 2 arguments is deprecated. Use either IntlCalendar::setDate()
or IntlCalendar::setDateTime() instead.
. Calling intlgregcal_create_instance() as well as calling
IntlGregorianCalendar::__construct() with more than 2 arguments is
deprecated. Use either IntlGregorianCalendar::createFromDate() or
IntlGregorianCalendar::createFromDateTime() instead.
- LDAP:
. Calling ldap_connect() with more than 2 arguments is deprecated. Use
ldap_connect_wallet() instead.
. Calling ldap_exop() with more than 4 arguments is deprecated. Use
ldap_exop_sync() instead.
- PgSQL:
. Calling pgsql_fetch_result() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
. Calling pg_field_prtlen() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
. Calling pg_field_is_null() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
- Reflection:
. Calling ReflectionMethod::__construct() with 1 argument is deprecated.
Use ReflectionMethod::createFromMethodName() instead.
- Session:
. Calling session_set_save_handler() with more than 2 arguments is
deprecated. Use the 2-parameter signature instead.
- Standard:
. Calling stream_context_set_option() with 2 arguments is deprecated.
Use stream_context_set_options() instead.
========================================
2014-05-01 10:27:38 +00:00
5. Changed Functions
========================================
2009-06-23 19:40:31 +00:00
- DOM:
. DOMDocument::registerNodeClass() now has a tentative return type of true.
Previously, the return type was bool but only true could be returned in practice.
- Intl:
. IntlDateFormatter::__construct() throws a ValueError if the locale is invalid.
. NumberFormatter::__construct() throws a ValueError if the locale is invalid.
- MBString:
. The behavior of mb_strcut is more consistent now on invalid UTF-8 and UTF-16
strings. (For valid UTF-8 and UTF-16 strings, there is no change.)
- PDO:
. getAttribute, enabled to get the value of ATTR_STRINGIFY_FETCHES.
- PDO_FIREBIRD:
. getAttribute, enabled to get values of FB_ATTR_DATE_FORMAT, FB_ATTR_TIME_FORMAT,
FB_ATTR_TIMESTAMP_FORMAT.
. Added new attributes to specify transaction isolation level and access mode.
Along with these, five constants (PDO::FB_TRANSACTION_ISOLATION_LEVEL,
PDO::FB_READ_COMMITTED, PDO::FB_REPEATABLE_READ, PDO::FB_SERIALIZABLE,
PDO::FB_WRITABLE_TRANSACTION) have been added.
- PDO_MYSQL:
. getAttribute, enabled to get the value of ATTR_FETCH_TABLE_NAMES.
2023-10-08 17:26:02 +00:00
- PGSQL:
. pg_select, the conditions arguments accepts an empty array and is optional.
- Standard:
. The internal implementation for rounding to integers has been rewritten
to be easier to verify for correctness and to be easier to maintain.
Some rounding bugs have been fixed as a result of the rewrite. For
example previously rounding 0.49999999999999994 to the nearest integer
would have resulted in 1.0 instead of the correct result 0.0. Additional
inputs might also be affected and result in different outputs compared to
earlier PHP versions.
. The default value of the 'cost' option for PASSWORD_BCRYPT for password_hash()
has been increased from '10' to '12'.
RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
========================================
2014-05-01 10:27:38 +00:00
6. New Functions
========================================
2022-09-04 18:52:21 +00:00
- DOM:
. Added DOMNode::compareDocumentPosition().
- MBString:
. Added mb_trim, mb_ltrim and mb_rtrim functions.
RFC: https://wiki.php.net/rfc/mb_trim
- Opcache:
. If JIT is enabled, PHP will now exit with a fatal error on startup in case
of JIT startup initialization issues.
- Sodium:
. Added the sodium_crypto_aead_aegis128l_*() and sodium_crypto_aead_aegis256l_*()
functions to support the AEGIS family of authenticated encryption algorithms,
that was introduced in libsodium 1.0.19.
. sodium_crypto_aead_aes256gcm_*() functions are now enabled on aarch64 CPUs
with the ARM cryptographic extensions.
========================================
2014-05-01 10:27:38 +00:00
7. New Classes and Interfaces
========================================
========================================
2015-02-10 07:56:18 +00:00
8. Removed Extensions and SAPIs
========================================
========================================
2014-05-01 10:27:38 +00:00
9. Other Changes to Extensions
========================================
2016-07-03 10:43:30 +00:00
- Intl:
. The class constants are typed now.
- PDO:
. The class constants are typed now.
- Reflection:
. The class constants are typed now.
- Spl:
. The class constants are typed now.
- Sqlite:
. The class constants are typed now.
2023-11-24 12:37:08 +00:00
- XSL:
. The typed properties XSLTProcessor::$cloneDocument and
XSLTProcessor::$doXInclude are now declared.
========================================
2014-05-01 10:27:38 +00:00
10. New Global Constants
========================================
2010-03-24 16:23:50 +00:00
- Intl:
. The IntlDateFormatter class exposes now the new PATTERN constant
reflecting udat api's UDAT_PATTERN.
- XML:
. Added XML_OPTION_PARSE_HUGE to allow large inputs in xml_parse and
xml_parse_into_struct.
RFC: https://wiki.php.net/rfc/xml_option_parse_huge.
========================================
2014-05-01 10:27:38 +00:00
11. Changes to INI File Handling
========================================
2014-08-22 11:35:07 +00:00
========================================
12. Windows Support
========================================
========================================
13. Other Changes
========================================
========================================
14. Performance Improvements
========================================
* The performance of DOMNode::C14N() is greatly improved for the case without
an xpath query. This can give a time improvement of easily two order of
magnitude for documents with tens of thousands of nodes.
2023-11-04 14:20:49 +00:00
* The performance of strspn() and strcspn() is greatly improved.
They now run in linear time instead of being bounded by quadratic time.
* mb_strcut() is much faster now for UTF-8 and UTF-16 strings.
Improve browscap get_browser performance (#12651) * Split function and use _new variant to avoid redundant checks * Precompute better array size to avoid rehashing * Use new function to add into array instead of merging into, preventing temporary memory allocations * Convert to regex without separate copy + lowering We're already doing a character-wise loop after lowering, so just lower it character by character instead of looping over it twice and allocating memory. * Use HASH_MAP loop because htab can never be packed This saves additional checks. * Move destructor to more sensible place * Remove now unused browscap_zval_copy_ctor * Use zend_string_release_ex variant where possible * Implement dedicated greedy wildcard matching algorithm This avoids compiling, allocating and caching regexes and should run in the same complexity. * Cache previous length instead of repeatedly recomputing it * Add additional optimization to wildcard * matching * Move cheap checks to the callsite The function prologue and epilogue have a stupidly high overhead for those 2 simple checks at the start. We can't always-inline the reg_compare function because it contains alloca, and the alloca is really important for performance. Instead, move those cheap checks to the call site. * Use specialised loop to avoid unnecessary conversions and checks * Optimize counting loop by taking into account the prefix * Precompute the hash values of known keys * [ci skip] UPGRADING * Code style * Add a note why we have the early-skip checks in the loop
2023-11-11 17:44:17 +00:00
* Looking up mbstring encoding names is much faster now.
2023-11-24 12:37:08 +00:00
* The performance of converting SJIS-win to unicode is greatly improved.
* get_browser() is much faster now, up to 1.5x - 2.5x for some test cases.