From 1c33ddb5e5598c5385c4c965992c6e031fd00dd6 Mon Sep 17 00:00:00 2001 From: Patrick Allaert Date: Tue, 31 Aug 2021 19:13:49 +0200 Subject: [PATCH] Prepare for PHP 8.2 --- CONTRIBUTING.md | 3 +- NEWS | 276 +------------------- UPGRADING | 571 +---------------------------------------- UPGRADING.INTERNALS | 118 +-------- Zend/zend.h | 2 +- Zend/zend_extensions.h | 2 +- Zend/zend_modules.h | 2 +- configure.ac | 2 +- main/php.h | 2 +- main/php_version.h | 6 +- 10 files changed, 14 insertions(+), 970 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f8a1abca4ec13..a70511ad64ad7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -329,7 +329,8 @@ Currently we have the following branches in use: | Branch | | | --------- | --------- | -| master | Active development branch for PHP 8.1, which is open for backwards incompatible changes and major internal API changes. | +| master | Active development branch for PHP 8.2, which is open for backwards incompatible changes and major internal API changes. | +| PHP-8.1 | Is used to release the PHP 8.1.x series. This is a current stable version and is open for bugfixes only. | | PHP-8.0 | Is used to release the PHP 8.0.x series. This is a current stable version and is open for bugfixes only. | | PHP-7.4 | Is used to release the PHP 7.4.x series. This is a current stable version and is open for bugfixes only. | | PHP-7.3 | Is used to release the PHP 7.3.x series. This is a current stable version and is open for bugfixes only. | diff --git a/NEWS b/NEWS index 86a5f34c51907..366cb53746276 100644 --- a/NEWS +++ b/NEWS @@ -1,279 +1,5 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 8.1.0RC1 - -- Core: - . Fixed bug #81377 (unset() of $GLOBALS sub-key yields warning). (Nikita) - -- COM: - . Dispatch using LANG_NEUTRAL instead of LOCALE_SYSTEM_DEFAULT. (Dmitry - Maksimov) - -- Date: - . Fixed bug #80998 (Missing second with inverted interval). (Derick) - . Speed up finding timezone offset information. (Derick) - -19 Aug 2021, PHP 8.1.0beta3 - -- Core: - . Fixed bug #81342 (New ampersand token parsing depends on new line after it). - (Nikita) - . Fixed bug #81280 (Unicode characters in cli.prompt causes segfault). - (krakjoe) - . Fixed bug #81192 ("Declaration should be compatible with" gives incorrect - line number with traits). (Nikita) - . Fixed bug #78919 (CLI server: insufficient cleanup if request startup - fails). (cataphract, cmb) - -- Date: - . Fixed bug #79580 (date_create_from_format misses leap year). (Derick) - . Fixed bug #80963 (DateTimeZone::getTransitions() truncated). (Derick) - . Fixed bug #80974 (Wrong diff between 2 dates in different timezones). - (Derick) - . Fixed bug #80998 (Missing second with inverted interval). (Derick) - . Fixed bug #81097 (DateTimeZone silently falls back to UTC when providing an - offset with seconds). (Derick) - . Fixed bug #81106 (Regression in 8.1: add() now truncate ->f). (Derick) - . Fixed bug #81273 (Date interval calculation not correct). (Derick) - -- Mbstring: - . Fixed bug #81349 (mb_detect_encoding misdetcts ASCII in some cases). - (Nikita) - -- PDO PgSQL: - . Fixed bug #81343 (pdo_pgsql: Inconsitent boolean conversion after calling - closeCursor()). (Philip Hofstetter) - -- Phar: - . Use SHA256 by default for signature. (remi) - . Add support for OpenSSL_SHA256 and OpenSSL_SHA512 signature. (remi) - -- SNMP: - . Implement SHA256 and SHA512 for security protocol. (remi) - -- Standard: - . Fixed bug #81142 (PHP 7.3+ memory leak when unserialize() is used on an - associative array). (Nikita) - -05 Aug 2021, PHP 8.1.0beta2 - -- Core: - . Fixed bug #81303 (match error message improvements). (krakjoe) - -- Mbstring: - . Fixed bug #81298 (mb_detect_encoding() segfaults when 7bit encoding is - specified). (Nikita) - -- MySQLnd: - . Fixed bug #63327 (Crash (Bus Error) in mysqlnd due to wrong alignment). - (Nikita) - -- Opcache: - . Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT) - . Fixed Bug #80959 (infinite loop in building cfg during JIT compilation) - (Nikita, Dmitry) - -- Reflection: - . Fixed bug #80821 (ReflectionProperty::getDefaultValue() returns current - value for statics). (Nikita) - . Fixed bug #80564 (ReflectionProperty::__toString() renders current value, - not default value). (Nikita) - -- SimpleXML: - . Fixed bug #81325 (Segfault in zif_simplexml_import_dom). (remi) - -22 Jul 2021, PHP 8.1.0beta1 - -- Core: - . Fixed bug #81238 (Fiber support missing for Solaris Sparc). (trowski) - . Fixed bug #81237 (Comparison of fake closures doesn't work). (krakjoe) - -- Opcache: - . Fixed bug #81225 (Wrong result with pow operator with JIT enabled). - (Dmitry) - . Fixed bug #81249 (Intermittent property assignment failure with JIT - enabled). (Dmitry) - . Fixed bug #81256 (Assertion `zv != ((void *)0)' failed for "preload" with - JIT). (Dmitry) - -- Reflection: - . Fixed bug #80097 (ReflectionAttribute is not a Reflector). (beberlei) - -- Standard: - . Fixed bug #81111 (Serialization is unexpectedly allowed on anonymous classes - with __serialize()). (Nikita) - -08 Jul 2021, PHP 8.1.0alpha3 - -- Core: - . Fixed bug #81202 (powerpc64 build fails on fibers). (krakjoe) - . Fixed bug #80072 (Cyclic unserialize in TMPVAR operand may leak). (Nikita) - -- Curl: - . Fixed bug #81085 (Support CURLOPT_SSLCERT_BLOB for cert strings). - (camporter) - -- Reflection: - . Fixed bug #81200 (no way to determine if Closure is static). (krakjoe) - -24 Jun 2021, PHP 8.1.0alpha2 - -- Core: - . Fixed bug #81163 (__sleep allowed to return non-array). (krakjoe) - -- Opcache: - . Fixed bug #81133 (building opcache with phpize fails). (krakjoe) - . Fixed bug #81136 (opcache header not installed). (krakjoe) - -- PDO OCI: - . Fixed bug #77120 (Support 'success with info' at connection). - (Sergei Morozov) - -- phpdbg: - . Fixed bug #81135 (unknown help topic causes assertion failure). (krakjoe) - -- SPL: - . Fixed bug #81112 (Special json_encode behavior for SplFixedArray). (Nikita) - . Fixed bug #80945 ("Notice: Undefined index" on unset() ArrayObject - non-existing key). (Nikita) - -- Standard: - . Fixed bug #81137 (hrtime breaks build on OSX before Sierra). (krakjoe) - -10 Jun 2021, PHP 8.1.0alpha1 - -- Core: - . Fixed inclusion order for phpize builds on Windows. (cmb) - . Added missing hashtable insertion APIs for arr/obj/ref. (Sara) - . Fixed bug #75474 (function scope static variables are not bound to a unique - function). (Nikita) - . Fixed bug #53826 (__callStatic fired in base class through a parent call if - the method is private). (Nikita) - . Implemented FR #77372 (Relative file path is removed from uploaded file). - (Björn Tantau) - . Fixed bug #81076 (incorrect debug info on Closures with implicit binds). - (krakjoe) - - - Standard: - . Fixed bug #77627 (method_exists on Closure::__invoke inconsistency). - (krakjoe) - -- Date: - . Fixed bug #52480 (Incorrect difference using DateInterval) (Derick) - . Fixed bug #62326 (date_diff() function returns false result) (Derick) - . Fixed bug #64992 (dst not handled past 2038) (Derick) - . Fixed bug #65003 (Wrong date diff) (Derick) - . Fixed bug #66545 (DateTime. diff returns negative values) (Derick) - . Fixed bug #68503 (date_diff on two dates with timezone set localised - returns wrong results) (Derick) - . Fixed bug #69806 (Incorrect date from timestamp) (Derick) - . Fixed bug #71700 (Extra day on diff between begin and end of march 2016) - (Derick) - . Fixed bug #71826 (DateTime::diff confuse on timezone 'Asia/Tokyo') (Derick) - . Fixed bug #73460 (Datetime add not realising it already applied DST - change) (Derick) - . Fixed bug #74173 (DateTimeImmutable::getTimestamp() triggers DST switch in - incorrect time) (Derick) - . Fixed bug #74274 (Handling DST transitions correctly) (Derick) - . Fixed bug #74524 (Date diff is bad calculated, in same time zone) (Derick) - . Fixed bug #75167 (DateTime::add does only care about backward DST - transition, not forward) (Derick) - . Fixed bug #76032 (DateTime->diff having issues with leap days for - timezones ahead of UTC) (Derick) - . Fixed bug #76374 (Date difference varies according day time) (Derick) - . Fixed bug #77571 (DateTime's diff DateInterval incorrect in timezones from - UTC+01:00 to UTC+12:00 (Derick) - . Fixed bug #78452 (diff makes wrong in hour for Asia/Tehran) (Derick) - . Fixed bug #79452 (DateTime::diff() generates months differently between - time zones) (Derick) - . Fixed bug #79698 (timelib mishandles future timestamps (triggered by 'zic - -b slim')) (Derick) - . Fixed bug #79716 (Invalid date time created (with day "00")) (Derick) - . Fixed bug #80610 (DateTime calculate wrong with DateInterval) (Derick) - . Fixed bug #80664 (DateTime objects behave incorrectly around DST - transition) (Derick) - . Fixed bug #80913 (DateTime(Immutable)::sub around DST yield incorrect - time) (Derick) - -- FPM: - . Added openmetrics status format. (Cees-Jan Kiewiet) - . Enable process renaming on macOS. (devnexen) - . Added pm.max_spawn_rate option to configure max spawn child processes rate. - (Paulius Sapragonas) - . Fixed bug #65800 (Events port mechanism). (psumbera) - -- FTP: - . Convert resource to object \FTP\Connection. (Sara) - -- GD: - . Convert resource to object \GdFont. (Sara) - -- hash: - . Implemented FR #68109 (Add MurmurHash V3). (Anatol, Michael) - . Implemented FR #73385 (Add xxHash support). (Anatol) - -- LDAP: - . Convert resource to object \LDAP\Connection. (Máté) - . Convert resource to object \LDAP\Result. (Máté) - . Convert resource to object \LDAP\ResultEntry. (Máté) - -- MySQLi: - . Fixed bug #70372 (Emulate mysqli_fetch_all() for libmysqlclient). (Nikita) - . Fixed bug #80330 (Replace language in APIs and source code/docs). - (Darek Ślusarczyk) - . Fixed bug #80329 (Add option to specify LOAD DATA LOCAL white list folder - (including libmysql)). (Darek Ślusarczyk) - -- MySQLnd: - . Fixed bug #80761 (PDO uses too much memory). (Nikita) - -- OPcache: - . Added inheritance cache. (Dmitry) - -- OpenSSL: - . Bump minimal OpenSSL version to 1.0.2. (Jakub Zelenka) - -- PCRE: - . Bundled PCRE2 is 10.37. - -- PDO: - . Fixed bug #40913 (PDO_MYSQL: PDO::PARAM_LOB does not bind to a stream for - fetching a BLOB). (Nikita) - -. PDO MySQL: - . Fixed bug #80908 (PDO::lastInsertId() return wrong). (matt) - . Fixed bug #81037 (PDO discards error message text from prepared - statement). (Kamil Tekiela) - -. PDO ODBC: - . Implement PDO_ATTR_SERVER_VERSION and PDO_ATTR_SERVER_INFO for - PDO::getAttribute(). (Calvin Buckley) - -. PDO SQLite: - . Fixed bug #38334 (Proper data-type support for PDO_SQLITE). (Nikita) - -- PgSQL: - . Convert resource to object \PgSql\Connection. (Máté) - . Convert resource to object \PgSql\Result. (Máté) - . Convert resource to object \PgSql\Lob. (Máté) - -- PSpell: - . Convert resource to object \PSpell\Dictionary. (Sara) - . Convert resource to object \PSpell\Config. (Sara) - -- readline: - . Fixed bug #72998 (invalid read in readline completion). (krakjoe) - -- Reflection: - . Implement ReflectionFunctionAbstract::getClosureUsedVariables (krakjoe) - -- Sodium: - . Added the XChaCha20 stream cipher functions. (P.I.E. Security Team) - . Added the Ristretto255 functions, which are available in libsodium 1.0.18. - (P.I.E. Security Team) - -- SPL: - . Fixed bug #80724 (FilesystemIterator::FOLLOW_SYMLINKS remove KEY_AS_FILE - from bitmask). (Cameron Porter) +?? ??? ????, PHP 8.2.0alpha1 <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index f19b273d7c525..850bc2e13b13d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -1,4 +1,4 @@ -PHP 8.1 UPGRADE NOTES +PHP 8.2 UPGRADE NOTES 1. Backward Incompatible Changes 2. New Features @@ -19,544 +19,30 @@ PHP 8.1 UPGRADE NOTES 1. Backward Incompatible Changes ======================================== -- Core: - . Access to the $GLOBALS array is now subject to a number of restrictions. - Read and write access to individual array elements like $GLOBALS['var'] - continues to work as-is. Read-only access to the entire $GLOBALS array also - continues to be supported. However, write access to the entire $GLOBALS - array is no longer supported. For example, array_pop($GLOBALS) will result - in an error. - RFC: https://wiki.php.net/rfc/restrict_globals_usage - . Passing null to a non-nullable argument of a built-in function is - deprecated. This matches the behavior of user-defined functions, where null - is never accepted by non-nullable arguments. - user-defined functions. - - var_dump(str_contains("foobar", null)); - // Deprecated: Passing null to parameter #2 ($needle) of type string - // is deprecated - - RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg - . When a method using static variables is inherited (but not overridden), the - inherited method will now share static variables with the parent method. - - class A { - public static function counter() { - static $counter = 0; - $counter++; - return $counter; - } - } - class B extends A {} - - var_dump(A::counter()); // int(1) - var_dump(A::counter()); // int(2) - var_dump(B::counter()); // int(3), previously int(1) - var_dump(B::counter()); // int(4), previously int(2) - - This means that static variables in methods now behave the same way as - static properties. - RFC: https://wiki.php.net/rfc/static_variable_inheritance - . Most non-final internal methods now require overriding methods to declare a - compatible return type, otherwise a deprecated notice is emitted during - inheritance validation. - In case the return type cannot be declared for an overriding method due to - PHP cross-version compatibility concerns, a `#[ReturnTypeWillChange]` - attribute can be added to silence the deprecation notice. - RFC: https://wiki.php.net/rfc/internal_method_return_types - -- Fileinfo: - . The fileinfo functions now accept and return, respectively, finfo objects - instead of resources. Return value checks using is_resource() - should be replaced with checks for `false`. - -- FTP: - . The FTP functions now accept and return, respectively, FTP\Connection objects - instead of resources. Return value checks using is_resource() - should be replaced with checks for `false`. - -- IMAP: - . The IMAP functions now accept and return, respectively, IMAP\Connection objects - instead of resources. Return value checks using is_resource() - should be replaced with checks for `false`. - -- LDAP: - . The LDAP functions now accept and return, respectively, LDAP\Connection objects - instead of "ldap link" resources. Return value checks using is_resource() - should be replaced with checks for `false`. - . The LDAP functions now accept and return, respectively, LDAP\Result objects - instead of "ldap result" resources. Return value checks using is_resource() - should be replaced with checks for `false`. - . The LDAP functions now accept and return, respectively, LDAP\ResultEntry - objects instead of "ldap result entry" resources. Return value checks using - is_resource() should be replaced with checks for `false`. - -- MySQLi: - . mysqli_fetch_fields() and mysqli_fetch_field_direct() will now always return - zero for max_length. You can compute this information by iterating over the - result set and taking the maximum length. This is what PHP was doing - internally previously. - . The MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH option no longer has an effect. - . The MYSQLI_STORE_RESULT_COPY_DATA option no longer has an effect. - . The default error handling mode has been changed from "silent" to - "exceptions". See https://www.php.net/manual/en/mysqli-driver.report-mode.php - for details of behavior changes and how to explicitly set this attribute. To - keep the old behavior, use mysqli_report(MYSQLI_REPORT_OFF); - RFC: https://wiki.php.net/rfc/mysqli_default_errmode - . Classes extending mysqli_stmt::execute() will be required to specify the - additional parameter now. - RFC: https://wiki.php.net/rfc/mysqli_bind_in_execute - . mysqli::connect() will now return true instead of null on success. - -- MySQLnd: - . The mysqlnd.fetch_copy_data ini setting has been removed. However, this - should not result in user-visible behavior changes. - -- OpenSSL: - . EC private keys will now be exported in PKCS#8 format rather than - traditional format, just like all other keys. - . openssl_pkcs7_encrypt() and openssl_cms_encrypt() will now default to - using AES-128-CBC rather than RC2-40. The RC2-40 cipher is considered - insecure and not enabled by default in OpenSSL 3. - -- PDO: - . PDO::ATTR_STRINGIFY_FETCHES now also stringifies values of type bool to - "0" or "1". Previously booleans were not stringified. - . Calling bindColumn() with PDO::PARAM_LOB (and assuming stringification is - not enabled) will now consistently bind a stream result, as documented. - Previously the result would be either a stream or a string depending on the - used database driver and the time the binding is performed. - -- PDO MySQL: - . Integers and floats in result sets will now be returned using native PHP - types instead of strings when using emulated prepared statements. This - matches the behavior of native prepared statements. You can restore the - previous behavior by enabling the PDO::ATTR_STRINGIFY_FETCHES option. - -- PDO SQLite: - . Integers and floats in results sets will now be returned using native PHP - types. You can restore the previous behavior by enabling the - PDO::ATTR_STRINGIFY_FETCHES option. - -- PgSQL: - . The PgSQL functions now accept and return, respectively, \PgSql\Connection - objects instead of "pgsql link" resources. Return value checks using - is_resource() should be replaced with checks for `false`. - . The PgSQL functions now accept and return, respectively, \PgSql\Result - objects instead of "pgsql result" resources. Return value checks using - is_resource() should be replaced with checks for `false`. - . The PgSQL functions now accept and return, respectively, \PgSql\Lob - objects instead of "pgsql large object" resources. Return value checks - using is_resource() should be replaced with checks for `false`. - -- Phar: - . To comply with the ArrayAccess interface, Phar::offsetUnset() and - PharData::offsetUnset() no longer return a boolean. - -- PSpell: - . The PSpell functions now accept and return, respectively, PSpell\Dictionary objects - instead of "pspell" resources. Return value checks using is_resource() - should be replaced with checks for `false`. - . The PSpell functions now accept and return, respectively, PSpell\Config objects - instead of "pspell config" resources. Return value checks using is_resource() - should be replaced with checks for `false`. - -- Standard: - . version_compare() no longer accepts undocumented operator abbreviations. - . htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), - html_entity_decode() and get_html_translation_table() now use - ENT_QUOTES | ENT_SUBSTITUTE rather than ENT_COMPAT by default. This means - that ' is escaped to ' while previously it was left alone. - Additionally, malformed UTF-8 will be replaced by a Unicode substitution - character, instead of resulting in an empty string. - . debug_zval_dump() will now print reference wrappers with their refcount, - instead of only prepending a "&" to the value. This more accurately models - reference representation since PHP 7.0. - . debug_zval_dump() will not print "interned" instead of a dummy refcount of - one for interned strings and immutable arrays. - -- SPL: - . SplFixedArray will now be JSON encoded like an array. - ======================================== 2. New Features ======================================== -- Core: - . It is now possible to specify octal integer by using the explicit "0o"/"0O" - prefix similar to hexadecimal ("0x"/"0X) and binary ("0b"/"0B") integer - literals. - RFC: https://wiki.php.net/rfc/explicit_octal_notation - . Added support for array unpacking with strings keys. - RFC: https://wiki.php.net/rfc/array_unpacking_string_keys - . Added support for enumerations. - RFC: https://wiki.php.net/rfc/enumerations - . Added support for never return type - RFC: https://wiki.php.net/rfc/noreturn_type - . Added support for fibers. - RFC: https://wiki.php.net/rfc/fibers - . It is now possible to use "new ClassName()" expressions as parameter - default values, static variable and global constant initializers, as well - as attribute arguments. Objects can also be passed to `define()` now. - RFC: https://wiki.php.net/rfc/new_in_initializers - . Closures for callables can now be created using the syntax `myFunc(...)`, - which is the same as `Closure::fromCallable('myFunc')`. Yes, the `...` is - part of the syntax, not an omission. - RFC: https://wiki.php.net/rfc/first_class_callable_syntax - . File uploads now provide an additional full_path key, which contains the - full path (rather than just the basename) of the uploaded file. This is - intended for use in conjunction with "upload webkitdirectory". - . It is now allowed to specify named arguments after an argument unpack, e.g. - foo(...$args, named: $arg). - . Added support for intersection types. - They cannot be combined with union types. - RFC: https://wiki.php.net/rfc/pure-intersection-types - . Added support for the final modifier for class constants. - RFC: https://wiki.php.net/rfc/final_class_const - . Added support for readonly properties. - RFC: https://wiki.php.net/rfc/readonly_properties_v2 - -- Curl: - . Added CURLOPT_DOH_URL option. - . Added certificate blob options when for libcurl >= 7.71.0: - - CURLOPT_ISSUERCERT_BLOB - CURLOPT_PROXY_ISSUERCERT - CURLOPT_PROXY_ISSUERCERT_BLOB - CURLOPT_PROXY_SSLCERT_BLOB - CURLOPT_PROXY_SSLKEY_BLOB - CURLOPT_SSLCERT_BLOB - CURLOPT_SSLKEY_BLOB - - . Added CURLStringFile, which can be used to post a file from a string rather - than a file: - - $file = new CURLStringFile($data, 'filename.txt', 'text/plain'); - curl_setopt($curl, CURLOPT_POSTFIELDS, ['file' => $file]); - -- FPM: - . Added openmetrics status format. It can be used by Prometheus to fetch FPM - metrics. - . Added new pool option for the dynamic process manager called - pm.max_spawn_rate. It allows to start number of children in a faster rate - when dynamic pm is selected. The default value is 32 which was the previous - hard coded value. - -- GD: - . Avif support is now available through the imagecreatefromavif() and - imageavif() functions, if libgd has been built with avif support. - -- hash: - . The following functions have changed signatures, to support an optional `$options` argument: - - - function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {} - - function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {} - - function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {} - - The additional `$options` argument can be used to pass algorithm specific data. - - . Added MurmurHash3 with streaming support. The following variants are implemented: - - - murmur3a, 32-bit hash - - murmur3c, 128-bit hash for x86 - - murmur3f, 128-bit hash for x64 - - The initial hash state can be passed through the `seed` key in the `$options` array, for example: - - ```php - $h = hash("murmur3f", $data, options: ["seed" => 42]); - echo $h, "\n"; - ``` - - A valid seed value is within the range from 0 to the platform defined UINT_MAX, usually 4294967295. - - . Added xxHash. The implementation brings in the following arguments - - - xxh32, 32-bit hash - - xxh64, 64-bit hash - - xxh3, 64-bit hash - - xxh128, 128-bit hash - - The initial hash state can be passed through the `seed` key in the `$options` array, for example: - - ```php - $h = hash("xxh3", $data, options: ["seed" => 42]); - echo $h, "\n"; - ``` - - Secret usage is supported through passing the `secret` key in the `$options` array, too: - - ```php - $h = hash("xxh3", $data, options: ["secret" => "at least 136 bytes long secret here"]); - echo $h, "\n"; - ``` - - Note, that the quality of the custom secret is crucial for the quality of the resulting hash. It is - highly recommended for the secret to use the best possible entropy. - -- MySQLi: - . The mysqli.local_infile_directory ini setting has been added, which can be - used to specify a directory from which files are allowed to be loaded. It - is only meaningful if mysqli.allow_local_infile is not enabled, as all - directories are allowed in that case. - . Binding in execute has been added to mysqli prepared statements. - Parameters can now be passed to mysqli_stmt::execute as an array. - RFC: https://wiki.php.net/rfc/mysqli_bind_in_execute - . A new method has been added to mysqli_result called mysqli_fetch_column(). - It allows for fetching single scalar values from the result set. - RFC: https://wiki.php.net/rfc/mysqli_fetch_column - -- PDO MySQL: - . The PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY attribute has been added, which - can be used to specify a directory from which files are allowed to be - loaded. It is only meaningful if PDO::MYSQL_ATTR_LOCAL_INFILE is not - enabled, as all directories are allowed in that case. - -- PDO SQLite: - . SQLite's "file:" DSN syntax is now supported, which allows specifying - additional flags. This feature is not available if open_basedir is set. - Example: - - new PDO('sqlite:file:path/to/sqlite.db?mode=ro') - -- Posix: - . Added POSIX_RLIMIT_KQUEUES and POSIX_RLIMIT_NPTS. These rlimits are only - available on FreeBSD. - -- Standard: - . fputcsv() now accepts a new "eol" argument which allow to define a custom - eol sequence, the default remains the same and is "\n". - -- SPL: - . SplFileObject::fputcsv() now accepts a new "eol" argument which allow to - define a custom eol sequence, the default remains the same and is "\n". - ======================================== 3. Changes in SAPI modules ======================================== -- CLI: - . Using -a without the readline extension will now result in an error. - Previously, -a without readline had the same behavior as calling php without - any arguments, apart from printing an additional "Interactive mode enabled" - message. This mode was not, in fact, interactive. - -- phpdbg: - . Remote functionality from phpdbg has been removed. - ======================================== 4. Deprecated Functionality ======================================== -- Core: - . Implementing the Serializable interface without also implementing - __serialize() and __unserialize() has been deprecated. You should either - implement the new methods (if you only support PHP 7.4 and higher) or - implement both (if you support older PHP versions as well). - RFC: https://wiki.php.net/rfc/phase_out_serializable - . Implicit conversion of floats to integers that result in loss of precision, - e.g. a truncation from 1.9 to 1, is deprecated. This affects array keys, - int parameter and return types, and operators working on integers. - RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate - . Calling a static method or accessing a static property directly on a trait - is deprecated. Static methods and properties should only be accessed on a - class using the trait. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . Returning a non-array from __sleep will raise a warning - . Returning by reference from a void function is deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . Automatic conversion of "false" into an empty array on write operands is - deprecated. - RFC: https://wiki.php.net/rfc/autovivification_false - -- Ctype: - . Passing a non-string value to ctype_*() functions is deprecated. A future - version of PHP will make ctype_*() accept a string argument, which means - that either only strings will be accepted (strict_types=1) or inputs may be - converted to string (strict_types=0). In particular, using ctype_*($cp) to - check whether an ASCII codepoint given as integer satisfies a given ctype - predicate will no longer be supported. Instead ctype_*(chr($cp)) should be - used. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- Date: - . The date_sunrise() and date_sunset() functions have been deprecated in - favor of date_sun_info(). - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . The strftime() and gmstrftime() functions have been deprecated in favor of - date()/DateTime::format() (for locale-independent formatting) or - IntlDateFormatter::format() (for locale-dependent formatting). - -- Filter: - . The FILTER_SANITIZE_STRING and FILTER_SANITIZE_STRIPPED filters have been - deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . The filter.default ini setting is deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- GD: - . The $num_points parameter of image(open|filled)polygon has been deprecated. - -- Hash: - . The mhash(), mhash_keygen_s2k(), mhash_count(), mhash_get_block_size() and - mhash_get_hash_name() functions are deprecated. Use the hash_*() APIs - instead. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- IMAP: - . The NIL constant has been deprecated. Use 0 instead. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- Intl: - . Calling IntlCalendar::roll() with bool argument is deprecated. Pass 1 and -1 - instead of true and false respectively. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- Mbstring: - . Calling mb_check_encoding() without an argument is deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- MySQLi: - . The mysqli_driver::$driver_version property has been deprecated. The driver - version is meaningless as it hasn't been updated in more than a decade. Use - PHP_VERSION_ID instead. - . Calling mysqli::get_client_info in OO style or passing $mysqli argument to - mysqli_get_client_info() function has been deprecated. Use - mysqli_get_client_info() without any arguments to obtain the client - library version information. - . The mysqli::init() method has been deprecated. Replace calls to - parent::init() with parent::__construct(). - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- OCI8: - . The INI directive oci8.old_oci_close_semantics has been deprecated. - -- ODBC: - . odbc_result_all() has been deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- PDO: - . The PDO::FETCH_SERIALIZE mode has been deprecated. - RFC: https://wiki.php.net/rfc/phase_out_serializable - -- PgSQL: - . Not passing the connection argument to PgSQL functions and using the - default connection is deprecated. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- SOAP: - . The ssl_method option for the SoapClient constructor has been deprecated in - favor of ssl stream context options. The direct equivalent would be - crypto_method, but min_proto_version/max_proto_version are recommended - instead. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - -- Standard: - . Calling key(), current(), next(), prev(), reset(), or end() on objects - is deprecated. Instead cast the object to array first, or make use of - ArrayIterator. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . The strptime() function has been deprecated. Use date_parse_from_format() - instead (for locale-independent parsing) or IntlDateFormatter::parse() (for - locale-dependent parsing). - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . The auto_detect_line_endings ini setting has been deprecated. If necessary, - handle "\r" line breaks manually instead. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - . The FILE_BINARY and FILE_TEXT constants are deprecated. They already had - no effect previously. - RFC: https://wiki.php.net/rfc/deprecations_php_8_1 - ======================================== 5. Changed Functions ======================================== -- Core: - . Properties order used in foreach, var_dump(), serialize(), object comparison - etc. was changed. Now properties are naturally ordered according to their - declaration and inheritance. Properties declared in a base class are going - to be before the child properties. This order is consistent with internal - layout of properties in zend_object structure and repeats the order in - default_properties_table[] and properties_info_table[]. The old order was - not documented and was caused by class inheritance implementation details. - -- Filter: - . The FILTER_FLAG_ALLOW_OCTAL flag of the FILTER_VALIDATE_INT filter now accept - octal string with the leading octal prefix ("0o"/"0O") - RFC: https://wiki.php.net/rfc/explicit_octal_notation - -- GMP: - . All GMP function now accept octal string with the leading octal prefix ("0o"/"0O") - RFC: https://wiki.php.net/rfc/explicit_octal_notation - -- PDO ODBC: - . PDO::getAttributes() with PDO::ATTR_SERVER_INFO and PDO::ATTR_SERVER_VERSION - now return values instead of throwing PDOException. - -- Reflection: - . ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() - no longer have an effect. Properties and methods are always considered - accessible through reflection. - RFC: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op - -- Standard: - . syslog() is now binary safe. - ======================================== 6. New Functions ======================================== -- Core: - . Added array_is_list(array $array), which will return true if the array keys are 0 .. count($array)-1 in that order. - RFC: https://wiki.php.net/rfc/is_list - -- pcntl: - . Added pcntl_rfork for FreeBSD variants - -- Reflection: - . Added ReflectionFunctionAbstract::getClosureUsedVariables - -- Standard: - . Added fsync() and fdatasync(), which instruct the operating system to - flush its buffers to physical storage. - RFC: https://wiki.php.net/rfc/fsync_function - -- Sodium: - . Added the XChaCha20 stream cipher interface functions: - - - sodium_crypto_stream_xchacha20() - - sodium_crypto_stream_xchacha20_keygen() - - sodium_crypto_stream_xchacha20_xor() - - . Added the Ristretto255 functions, which are available in libsodium 1.0.18. - - Ristretto is a technique for constructing prime order elliptic curve groups with non-malleable encodings. - Ristretto255 implements Ristretto atop Curve25519. - - - sodium_crypto_core_ristretto255_add() - - sodium_crypto_core_ristretto255_from_hash() - - sodium_crypto_core_ristretto255_is_valid_point() - - sodium_crypto_core_ristretto255_random() - - sodium_crypto_core_ristretto255_scalar_add() - - sodium_crypto_core_ristretto255_scalar_complement() - - sodium_crypto_core_ristretto255_scalar_invert() - - sodium_crypto_core_ristretto255_scalar_mul() - - sodium_crypto_core_ristretto255_scalar_negate() - - sodium_crypto_core_ristretto255_scalar_random() - - sodium_crypto_core_ristretto255_scalar_reduce() - - sodium_crypto_core_ristretto255_scalar_sub() - - sodium_crypto_core_ristretto255_sub() - - sodium_crypto_scalarmult_ristretto255() - - sodium_crypto_scalarmult_ristretto255_base() - ======================================== 7. New Classes and Interfaces ======================================== -- Intl: - . Added IntlDatePatternGenerator to dynamically generate patterns to use with IntlDateFormatter. - RFC: https://wiki.php.net/rfc/intldatetimepatterngenerator - ======================================== 8. Removed Extensions and SAPIs ======================================== @@ -565,69 +51,14 @@ PHP 8.1 UPGRADE NOTES 9. Other Changes to Extensions ======================================== -- GD: - imagewebp() can do lossless WebP encoding by passing IMG_WEBP_LOSSLESS as - quality. This constant is only defined, if a libgd is used which supports - lossless WebP encoding. - -- MySQLi: - . The mysqli_stmt::next_result() and mysqli::fetch_all() methods are now - available when linking against libmysqlclient. - -- OpenSSL: - . The OpenSSL extension now requires at least OpenSSL version 1.0.2. - . OpenSSL 3.0 is now supported. Be aware that many ciphers are no longer - enabled by default (part of the legacy provider), and that parameter - validation (e.g. minimum key sizes) is stricter now. - -- Phar: - . Use SHA256 by default for signature. - . Add support for OpenSSL_SHA256 and OpenSSL_SHA512 signature. - -- SNMP: - . add SHA256 and SHA512 for security protocol. - -- Standard: - . --with-password-argon2 now uses pkg-config to detect libargon2. As such, - an alternative libargon2 location should now be specified using - PKG_CONFIG_PATH. - ======================================== 10. New Global Constants ======================================== -- MySQLi: - . MYSQLI_REFRESH_REPLICA has been added as a replacement for - MYSQLI_REFRESH_SLAVE, in line with an upstream change in MySQL. The old - constant is still available for backwards-compatibility reasons, but may - be deprecated/removed in the future. - -- Sockets: - . The following socket options are now defined if they are supported: - * SO_ACCEPTFILTER - * SO_DONTTRUNC - * SO_WANTMORE - * SO_MARK - * TCP_DEFER_ACCEPT - ======================================== 11. Changes to INI File Handling ======================================== -- The log_errors_max_len ini setting has been removed. It no longer had an - effect since PHP 8.0. - -- A leading dollar in a quoted string can now be escaped: "\${" will now be - interpreted as a string with contents `${`. - -- Backslashes in double quoted strings are now more consistently treated as - escape characters. Previously, "foo\\" followed by something other than a - newline was not considered as a teminated string. It is now interpreted as a - string with contents `foo\`. However, as an exception, the string "foo\" - followed by a newline will continue to be treated as a valid string with - contents `foo\` rather than an unterminated string. This exception exists to - support naive uses of Windows file pahts as "C:\foo\". - ======================================== 12. Windows Support ======================================== diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index ec4d17f20ac67..18a6239410e0f 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -1,134 +1,20 @@ -PHP 8.1 INTERNALS UPGRADE NOTES +PHP 8.2 INTERNALS UPGRADE NOTES 1. Internal API changes - a. Removed Zend APIs - b. Zend Stream API - c. zend_get_opcode_id() - d. Removed support for "p" printf format specifier - e. ZEND_ATOL() changes - f. Non-serializable classes should use ZEND_ACC_NOT_SERIALIZABLE - g. _zend_hash_find_known_hash renamed to zend_hash_find_known_hash - h. Renaming of ZEND_TYPE_HAS_CLASS() into ZEND_TYPE_IS_COMPLEX() - i. zend_resource handle is now zend_long 2. Build system changes - a. New compiler flags 3. Module changes - a. ext/hash - b. ext/pdo - c. ext/standard - d. ext/pgsql - e. ext/pcre ======================== 1. Internal API changes ======================== - a. The following APIs have been removed from the Zend Engine: - - The spl_ce_Aggregate, spl_ce_ArrayAccess, spl_ce_Countable, spl_ce_Iterator, spl_ce_Serializable, - spl_ce_Stringable, spl_ce_Traversable alias class entries have been removed in favor of zend_ce_aggregate, - zend_ce_arrayaccess, zend_ce_countable, zend_ce_iterator, zend_ce_serializable, zend_ce_stringable, - zend_ce_traversable. - - The ZVAL_NEW_ARR() macro has been removed. Use array_init() or ZVAL_ARR - with zend_new_array() instead. - - The IGNORE_URL_WIN macro has been removed; it had no effect as of PHP 5.0.0. - - TsHashTable has been removed, it was not used in php-src and was not useful outside of php-src. - b. Zend Stream API has been changed to use "zend_string*" instead of "char*" - - zend_file_handle.filename now is zend_string* - - zend_file_handle.free_filename is removed. Now zend_file_handle.filename is always released. - - added zend_file_handle.primary_script flag. SAPIs should set it for main executed script. - - added zend_file_handle.in_list flag, which is set when a file_handle is added into CG(open_files) - - added zend_stream_init_filename_ex() function, that takes filename as zend_string* - - the "filename" parameter of functons zend_stream_open(), php_stream_open_for_zend_ex() and - callback zend_stream_open_function() has been removed (it's now passed as a "filename" field of the - file_handle parameter) - - in zend_fopen() and zend_resolve_path() callbacks filename now passed as zend_string* - - file_handles should be destroyed by zend_destroy_file_handle() function (usually in the same function - the same function where they were created by zend_stream_init_*()). Previously there were two different - destructors zend_destroy_file_handle() and zend_file_handle_dtor(). - - zend_ini_scanner_globals.filename now is zend_string* - c. Added the zend_get_opcode_id() function, which is intended to get opcode id from name. - d. Removed support for "p" modifier (%pd, %pu, etc) in PHP's printf - implementations. Use ZEND_LONG_FMT and ZEND_ULONG_FMT instead. - e. ZEND_ATOL() now returns the integer instead of assigning it as part of the - macro. Replace ZEND_ATOL(i, s) with i = ZEND_ATOL(s). - f. Non-serializable classes should be indicated using the - ZEND_ACC_NOT_SERIALIZABLE (@not-serializable in stubs) rather than the - zend_class_(un)serialize_deny handlers which are removed. - g. _zend_hash_find_known_hash has been renamed to zend_hash_find_known_hash. - h. ZEND_TYPE_HAS_CLASS() has been renamed to ZEND_TYPE_IS_COMPLEX() for clarity. - A zend_type element can contain a zend_type_list which might be either a union or an intersection, - or a single class stored as either a zend_string* or a zend_class_entry*. - i. The handle member of zend_resource (the resource ID) now has type zend_long - rather than int. This should be transparent to most code, but uses in - printf may need to switch from "%d" to ZEND_LONG_FMT. ======================== 2. Build system changes ======================== - a. New compiler flags - - [-Wimplicit-fallthrough=1] is now enabled by default. - It is possible to use the new ZEND_FALLTHROUGH macro keyword to suppress the warning. + ======================== 3. Module changes ======================== - a. ext/hash - - The init signatures are extended with an additional `HashTable*` - argument. The passed HT is to contain the algorithm specific - configuration. If an algorithm doesn't make use of any additional - configuration, the argument is to be marked with ZEND_ATTRIBUTE_UNUSED. - - b. ext/pdo - - The "preparer" callback now accepts a zend_string* instead of - char* + size_t pair the query string. Similarly, the query_string and - active_query_string members of pdo_stmt_t are now zend_string*. - - The way in which drivers provide results has changed: Previously, - the "describer" callback populated the "pdo_type" member in the - pdo_column_data structure, and the "get_col" callback then had to return - pointers to data of appropriate type. - - In PHP 8.1, the "describer" callback no longer determines the pdo_type - (and this member has been removed from pdo_column_data). Instead, the - "get_col" callback accepts a zval pointer that may be populated with a - value of arbitrary type. This gives drivers more flexibility in - determining result types (e.g. based on whether a specific integer fits - the PHP integer type) and avoid awkward juggling of temporary buffers. - - As the "describer" no longer determines pdo_type, the "get_column_meta" - function is now responsible for providing this information for use by - getColumnMeta(). The type provided here does not need to match the type - returned by get_col (in fact no corresponding type might exist, e.g. for - floats). It should be the closest logical equivalent for the column type. - - The transaction, set_attribute, and preparer handler's return type - has been formalized to bool instead of int. - - The check_liveness handler's return type has been formalized to zend_return - instead of int. - - The closer, and fetch_error handlers have been voidified. - - The quoter handler now returns the quoted string as zend_string* instead - of returning a boolean, and the quoted string as a pair of out params. - Similarly the unquoted string is now a zend_string* instead of a pair of - char* and size_t length. - - The doer handler now accepts a zend_string* instead of char* + size_t - pair for the SQL statement. - - The last_id handler now returns a zend_string* instead of returning a - char* and the length as an out param, and accepts a zend_string* instead - of char* for the optional sequence/table name. - - The php_pdo_str_tolower_dup() PDO_API has been removed use zend_str_tolower_dup() - or zend_string_tolower_ex(). - - c. ext/standard - - The PHP API php_fputcsv() now takes an extra zend_string* argument at the end - for a custom EOL sequence, passing NULL provides the old default of "\n". - - d. ext/pgsql - - The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(), - php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() have had - their return type formalized to zend_result. - - The functions php_pgsql_meta_data(), php_pgsql_convert(), php_pgsql_insert(), - php_pgsql_update(), php_pgsql_delete(), and php_pgsql_select() now accept a - zend_string* instead of a char* for the table name. - - e. ext/pcre - - Bundled PCRE2 is at version 10.37. The most important diff to the previous - version is the JIT support on the S390 platform. diff --git a/Zend/zend.h b/Zend/zend.h index eeacc91eb0a9f..ff247e95540cd 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "4.1.0-dev" +#define ZEND_VERSION "4.2.0-dev" #define ZEND_ENGINE_3 diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index 57c8775092f78..3b8e2b3453ade 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi /* The first number is the engine version and the rest is the date (YYYYMMDD). * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 420201009 +#define ZEND_EXTENSION_API_NO 420210903 typedef struct _zend_extension_version_info { int zend_extension_api_no; diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 98957def7626a..fda01eedc5230 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -31,7 +31,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module -#define ZEND_MODULE_API_NO 20201009 +#define ZEND_MODULE_API_NO 20210903 #ifdef ZTS #define USING_ZTS 1 #else diff --git a/configure.ac b/configure.ac index c9a29f0e82f4e..ba25175eb7845 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice. dnl ---------------------------------------------------------------------------- AC_PREREQ([2.68]) -AC_INIT([PHP],[8.1.0-dev],[https://bugs.php.net],[php],[https://www.php.net]) +AC_INIT([PHP],[8.2.0-dev],[https://bugs.php.net],[php],[https://www.php.net]) AC_CONFIG_SRCDIR([main/php_version.h]) AC_CONFIG_AUX_DIR([build]) AC_PRESERVE_HELP_ORDER diff --git a/main/php.h b/main/php.h index 3b80a589c29d4..91ecbb21dc726 100644 --- a/main/php.h +++ b/main/php.h @@ -22,7 +22,7 @@ #include #endif -#define PHP_API_VERSION 20201009 +#define PHP_API_VERSION 20210903 #define PHP_HAVE_STREAMS #define YYDEBUG 0 #define PHP_DEFAULT_CHARSET "UTF-8" diff --git a/main/php_version.h b/main/php_version.h index 66d4367856e5a..e7993749fd9e5 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -1,8 +1,8 @@ /* automatically generated by configure */ /* edit configure.ac to change version number */ #define PHP_MAJOR_VERSION 8 -#define PHP_MINOR_VERSION 1 +#define PHP_MINOR_VERSION 2 #define PHP_RELEASE_VERSION 0 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "8.1.0-dev" -#define PHP_VERSION_ID 80100 +#define PHP_VERSION "8.2.0-dev" +#define PHP_VERSION_ID 80200