From 55390a7898d58ea61e951fe27eca3acd5d1b5426 Mon Sep 17 00:00:00 2001 From: Sergey Panteleev Date: Tue, 21 Nov 2023 19:01:51 +0300 Subject: [PATCH] PHP 8.3 release page updates Closes #827 Co-authored-by: Florian --- releases/8.3/languages/en.php | 9 +++-- releases/8.3/languages/ru.php | 3 +- releases/8.3/release.inc | 76 ++++++++++++++++++----------------- 3 files changed, 46 insertions(+), 42 deletions(-) diff --git a/releases/8.3/languages/en.php b/releases/8.3/languages/en.php index 0ad1638dd4..f5e2600c5f 100644 --- a/releases/8.3/languages/en.php +++ b/releases/8.3/languages/en.php @@ -1,10 +1,10 @@ 'PHP 8.3 is a major update of the PHP language. It contains many new features, such as explicit typing of class constants, deep-cloning of readonly properties and additions to the randomness functionality. As always it also includes performance improvements, bug fixes and general cleanup.', + 'common_header' => 'PHP 8.3 is a major update of the PHP language. It contains many new features, such as explicit typing of class constants, deep-cloning of readonly properties and additions to the randomness functionality. As always it also includes performance improvements, bug fixes, and general cleanup.', 'documentation' => 'Doc', 'main_title' => 'Released!', - 'main_subtitle' => 'PHP 8.3 is a major update of the PHP language.
It contains many new features, such as explicit typing of class constants, deep-cloning of readonly properties and additions to the randomness functionality. As always it also includes performance improvements, bug fixes and general cleanup.', + 'main_subtitle' => 'PHP 8.3 is a major update of the PHP language.
It contains many new features, such as explicit typing of class constants, deep-cloning of readonly properties and additions to the randomness functionality. As always it also includes performance improvements, bug fixes, and general cleanup.', 'upgrade_now' => 'Upgrade to PHP 8.3 now!', 'readonly_title' => 'Deep-cloning of readonly properties', @@ -15,7 +15,7 @@ 'override_title' => 'New #[\Override] attribute', 'override_description' => 'By adding the #[\Override] attribute to a method, PHP will ensure that a method with the same name exists in a parent class or in an implemented interface. Adding the attribute makes it clear that overriding a parent method is intentional and simplifies refactoring, because the removal of an overridden parent method will be detected.', 'randomizer_getbytesfromstring_title' => 'New Randomizer::getBytesFromString() method', - 'randomizer_getbytesfromstring_description' => 'The Random Extension that was added in PHP 8.2 was extended by a new method to generate random strings consisting of specific bytes only. This method allows to easily generate random identifiers, such as domain names, and numeric strings of arbitrary length.', + 'randomizer_getbytesfromstring_description' => 'The Random Extension that was added in PHP 8.2 was extended by a new method to generate random strings consisting of specific bytes only. This method allows the developer to easily generate random identifiers, such as domain names, and numeric strings of arbitrary length.', 'randomizer_getfloat_nextfloat_title' => 'New Randomizer::getFloat() and Randomizer::nextFloat() methods', 'randomizer_getfloat_nextfloat_description' => '

Due to the limited precision and implicit rounding of floating point numbers, generating an unbiased float lying within a specific interval is non-trivial and the commonly used userland solutions may generate biased results or numbers outside the requested range.

The Randomizer was also extended with two methods to generate random floats in an unbiased fashion. The Randomizer::getFloat() method uses the γ-section algorithm that was published in Drawing Random Floating-Point Numbers from an Interval. Frédéric Goualard, ACM Trans. Model. Comput. Simul., 32:3, 2022.

', 'dynamic_class_constant_fetch_title' => 'Dynamic class constant fetch', @@ -28,7 +28,7 @@ 'new_posix' => 'New posix_sysconf(), posix_pathconf(), posix_fpathconf(), and posix_eaccess() functions.', 'new_reflection' => 'New ReflectionMethod::createFromMethodName() method.', 'new_socket' => 'New socket_atmark() function.', - 'new_str' => 'New str_increment(), str_decrement(), and stream_context_set_options() functions.', + 'new_str' => 'New str_increment(), str_decrement(), and stream_context_set_options() functions.', 'new_ziparchive' => 'New ZipArchive::getArchiveFlag() method.', 'new_openssl_ec' => 'Support for generation EC keys with custom EC parameters in OpenSSL extension.', 'new_ini' => 'New INI setting zend.max_allowed_stack_size to set the maximum allowed stack size.', @@ -42,6 +42,7 @@ 'bc_mtrand' => 'The MT_RAND_PHP Mt19937 variant is deprecated.', 'bc_reflection' => 'ReflectionClass::getStaticProperties() is no longer nullable.', 'bc_ini' => 'INI settings assert.active, assert.bail, assert.callback, assert.exception, and assert.warning have been deprecated.', + 'bc_standard' => 'Calling get_class() and get_parent_class() without arguments are deprecated.', 'footer_title' => 'Better performance, better syntax, improved type safety.', 'footer_description' => '

For source downloads of PHP 8.3 please visit the downloads page. Windows binaries can be found on the PHP for Windows site. The list of changes is recorded in the ChangeLog.

diff --git a/releases/8.3/languages/ru.php b/releases/8.3/languages/ru.php index cef2e7e8fd..54bafafdf1 100644 --- a/releases/8.3/languages/ru.php +++ b/releases/8.3/languages/ru.php @@ -28,7 +28,7 @@ 'new_posix' => 'Новые функции posix_sysconf(), posix_pathconf(), posix_fpathconf() и posix_eaccess().', 'new_reflection' => 'Новый метод ReflectionMethod::createFromMethodName().', 'new_socket' => 'Новая функция socket_atmark().', - 'new_str' => 'Новые функции str_increment(), str_decrement() и stream_context_set_options().', + 'new_str' => 'Новые функции str_increment(), str_decrement() и stream_context_set_options().', 'new_ziparchive' => 'Новый метод ZipArchive::getArchiveFlag().', 'new_openssl_ec' => 'Поддержка генерации EC-ключей с пользовательскими EC-параметрами в модуле OpenSSL.', 'new_ini' => 'Новый параметр INI zend.max_allowed_stack_size для установки максимально допустимого размера стека.', @@ -42,6 +42,7 @@ 'bc_mtrand' => 'Вариант Mt19937 MT_RAND_PHP объявлен устаревшим.', 'bc_reflection' => 'ReflectionClass::getStaticProperties() теперь не возвращает значение null.', 'bc_ini' => 'Параметры INI assert.active, assert.bail, assert.callback, assert.exception и assert.warning объявлены устаревшими.', + 'bc_standard' => 'Вызов функции get_class() и get_parent_class() без аргументов объявлен устаревшим.', 'footer_title' => 'Выше производительность, лучше синтаксис, надёжнее система типов.', 'footer_description' => '

Для загрузки исходного кода PHP 8.3 посетите страницу Downloads. Бинарные файлы Windows находятся на сайте PHP for Windows. Список изменений перечислен на странице ChangeLog.

diff --git a/releases/8.3/release.inc b/releases/8.3/release.inc index 501f873067..c99a528383 100644 --- a/releases/8.3/release.inc +++ b/releases/8.3/release.inc @@ -141,17 +141,14 @@ PHP <<<'PHP' use PHPUnit\Framework\TestCase; -final class MyTest extends TestCase -{ +final class MyTest extends TestCase { protected $logFile; - protected function setUp(): void - { + protected function setUp(): void { $this->logFile = fopen('/tmp/logfile', 'w'); } - protected function taerDown(): void - { + protected function taerDown(): void { fclose($this->logFile); unlink('/tmp/logfile'); } @@ -172,18 +169,15 @@ PHP <<<'PHP' use PHPUnit\Framework\TestCase; -final class MyTest extends TestCase -{ +final class MyTest extends TestCase { protected $logFile; - protected function setUp(): void - { + protected function setUp(): void { $this->logFile = fopen('/tmp/logfile', 'w'); } #[\Override] - protected function taerDown(): void - { + protected function taerDown(): void { fclose($this->logFile); unlink('/tmp/logfile'); } @@ -213,23 +207,24 @@ PHP
dateTime = $dateTime; - } +readonly class Foo { + public function __construct( + public PHP $php + ) {} - public function __clone() - { - $this->dateTime = clone $this->dateTime; + public function __clone(): void { + $this->php = clone $this->php; } } -$today = new Foo(new \DateTime()); -$tomorrow = clone $today; +$instance = new Foo(new PHP()); +$cloned = clone $instance; -// Fatal error: Cannot modify readonly property Foo::$dateTime +// Fatal error: Cannot modify readonly property Foo::$php PHP ); ?> @@ -241,23 +236,24 @@ PHP
dateTime = $dateTime; - } +readonly class Foo { + public function __construct( + public PHP $php + ) {} - public function __clone() - { - $this->dateTime = clone $this->dateTime; + public function __clone(): void { + $this->php = clone $this->php; } } -$today = new Foo(new \DateTime()); -$tomorrow = clone $today; +$instance = new Foo(new PHP()); +$cloned = clone $instance; -$tomorrow->dateTime->modify('+1 day'); +$cloned->php->version = '8.3'; PHP ); ?>
@@ -272,7 +268,8 @@ PHP

RFC - +

@@ -282,6 +279,7 @@ PHP <<<'PHP' function json_validate(string $string): bool { json_decode($string); + return json_last_error() === JSON_ERROR_NONE; } @@ -312,7 +310,8 @@ PHP

RFC - +

@@ -381,7 +380,8 @@ PHP

RFC - +

@@ -395,6 +395,7 @@ function getFloat(float $min, float $max) { // return values outside the given range. This is impossible // to work around in userland. $offset = random_int(0, PHP_INT_MAX) / PHP_INT_MAX; + return $offset * ($max - $min) + $min; } @@ -474,6 +475,7 @@ PHP
  • +