[web-php] master: Preview PHP 8.2 Release page (#675)
| From: | Sergey Panteleev via GitHub | Date: | Wed, 07 Dec 2022 15:00:10 +0000 |
| Subject: | [web-php] master: Preview PHP 8.2 Release page (#675) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30660@lists.php.net to get a copy of this message | ||
Author: Sergey Panteleev (saundefined)
Committer: GitHub (web-flow)
Pusher: saundefined
Date: 2022-12-07T17:48:50+03:00
Commit: https://github.com/php/web-php/commit/2f88bae3192d33f091eae5eeb74de93731faf275
Raw diff: https://github.com/php/web-php/commit/2f88bae3192d33f091eae5eeb74de93731faf275.diff
Preview PHP 8.2 Release page (#675)
Co-authored-by: Roman Pronskiy <roman@pronskiy.com>
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
Changed paths:
A images/php8/logo_php8_2.svg
A images/php8/php_8_2_released.png
A releases/8.2/common.php
A releases/8.2/en.php
A releases/8.2/index.php
A releases/8.2/languages/en.php
A releases/8.2/languages/ru.php
A releases/8.2/release.inc
A releases/8.2/ru.php
M styles/php8.css
Diff:
diff --git a/images/php8/logo_php8_2.svg b/images/php8/logo_php8_2.svg
new file mode 100644
index 0000000000..5bfb8df725
--- /dev/null
+++ b/images/php8/logo_php8_2.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 24.3.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)
-->
+<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px"
+ viewBox="0 0 451 127" style="enable-background:new 0 0 451 127;"
xml:space="preserve">
+<style type="text/css">
+ .st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
+ .st1{fill:#FFFFFF;}
+ .st2{fill:#0F0F0F;}
+</style>
+<path class="st0"
d="M21.8,125.8h-21l18.7-96.1h40.3c12.1,0,21,3.2,26.5,9.5c5.6,6.4,7.2,15.2,5,26.7c-0.9,4.7-2.5,9-4.6,12.9
+ c-2.2,3.9-5,7.5-8.5,10.7c-4.2,3.9-8.8,6.7-13.9,8.4c-5.1,1.7-11.6,2.5-19.6,2.5h-18L21.8,125.8z
M67.7,49.2
+ c-2.7-2.9-8-4.4-15.9-4.4H37.5l-7.8,40.3h12.7c8.4,0,14.7-1.6,18.9-4.8c4.1-3.2,6.9-8.5,8.4-15.9C71,57.2,70.3,52.2,67.7,49.2z"/>
+<path class="st1"
d="M106.6,4.1h20.8l-5,25.6h18.5c11.7,0,19.7,2,24.1,6.1c4.4,4.1,5.8,10.7,4,19.8l-8.7,44.8h-21.1l8.3-42.6
+ c0.9-4.8,0.6-8.1-1-9.9c-1.6-1.8-5.1-2.6-10.4-2.6h-16.6l-10.7,55.1H87.9L106.6,4.1z"/>
+<path class="st0"
d="M185.2,125.8h-21l18.7-96.1h40.4c12.1,0,21,3.2,26.5,9.5c5.6,6.4,7.2,15.2,5,26.7c-0.9,4.7-2.5,9-4.6,12.9
+ c-2.2,3.9-5,7.5-8.5,10.7c-4.2,3.9-8.8,6.7-13.9,8.4c-5.1,1.7-11.6,2.5-19.6,2.5h-18L185.2,125.8z
M231.2,49.2
+ c-2.7-2.9-8-4.4-15.9-4.4h-14.4l-7.8,40.3h12.7c8.4,0,14.7-1.6,18.9-4.8c4.1-3.2,6.9-8.5,8.4-15.9C234.4,57.2,233.8,52.2,231.2,49.2
+ z"/>
+<path class="st1"
d="M317.5,48.5c-5.7-13.6-10.5-25.4-5.8-33.6c1.8-2.5,3.8-3.8,6-3.8c4.5,0,8.6,4.9,8.6,4.9l5.7,6.9l-3.6-8.2
+ c-0.2-0.3-6.3-14.2-17.2-14.2c-3.8,0-7.8,1.7-11.7,5.1l-0.1,0.1c-9.5,11-0.2,31.8,8.1,50.1l6.1,14.2c0,0,0.6,0.5,0,0
+ c2.8,7.3,5.6,16,3.9,22.4c-2.6,10-11.5,16.8-11.6,16.9l-5.7,4.4l6.9-2.2c0.7-0.2,16-5.2,19.7-18.5c2.3-10.9-0.6-21.8-3.5-30.2
+ c0.4-0.3-0.4,0.3,0,0L318,49.1"/>
+<path class="st2"
d="M334.4,9.9l-7.1-7.8l5.1,9.3c0.1,0.1,6.3,11.7-1.6,25.2c-2.9,4.2-7.4,8.4-13.1,12.6l-10.3,6.7
+ c-0.1-0.2-0.1-0.1,0,0l-0.4,0.3h0.1H307c-11.5,6.6-22.2,10.6-22.4,10.7c-15.9,7.1-25.9,18.1-27.3,30.3c-1.1,9.2,3.2,18.2,11.6,24.5
+ l0.1,0.1c5.3,3.2,11,4.8,17,4.8c15.7,0,28-10.9,28.5-11.4l7.7-6.9l-9.1,4.8c-0.1,0-7.7,4-15.6,4c-7.1,0-12.1-3.1-15.1-9.4
+ c-3.8-13.4,9.5-22.6,24.8-33.2c2-1.4,4.1-2.9,6.2-4.3l0.1-0.1l9.1-6.8c0.1-0.2,0.4-0.4,0.4-0.4c7.5-6.2,17.4-15.9,19.7-29.5
+ C344.5,21.1,334.8,10.4,334.4,9.9z"/>
+<path class="st1" d="M345.4,83h19.5l-3.5,17.7h-19.5L345.4,83z"/>
+<path class="st1"
d="M432.8,67.2c13.2-10.1,18.1-17.8,18.1-28.6c0-14.2-10.7-23.7-26.7-23.7c-11.4,0-21.4,5.2-29.5,15.3l-0.5,0.7
+ l11.4,13l0.8-0.8c6.7-7.1,11.7-9.9,17.2-9.9c5.4,0,8.4,2.7,8.4,7.5c0,4.6-3.1,8.8-10.6,14.5l-39.2,29.6l0,0l-3.1,15.7h61.4l3.4-17.7
+ h-31.8L432.8,67.2z"/>
+</svg>
diff --git a/images/php8/php_8_2_released.png b/images/php8/php_8_2_released.png
new file mode 100644
index 0000000000..357e322cb8
Binary files /dev/null and b/images/php8/php_8_2_released.png differ
diff --git a/releases/8.2/common.php b/releases/8.2/common.php
new file mode 100644
index 0000000000..966ca97d04
--- /dev/null
+++ b/releases/8.2/common.php
@@ -0,0 +1,75 @@
+<?php declare(strict_types=1);
+
+namespace releases\php82;
+
+include_once __DIR__ . '/../../include/prepend.inc';
+
+function language_redirect(string $currentLang): void {
+ // We don't use the general language selection of php.net,
+ // so soldier on with this one.
+ return;
+}
+
+function common_header(string $description): void {
+ global $MYSITE;
+
+ $meta_image_path = \htmlspecialchars(
+ \filter_var($MYSITE . 'images/php8/php_8_2_released.png', \FILTER_VALIDATE_URL));
+ $meta_description = \htmlspecialchars($description);
+
+ \site_header("PHP 8.2.0 Release Announcement", [
+ 'current' => 'php8',
+ 'css' => ['php8.css'],
+ 'meta_tags' => <<<META
+<meta name="twitter:card" content="summary_large_image" />
+<meta name="twitter:site" content="@official_php" />
+<meta name="twitter:title" content="PHP 8.2 Released" />
+<meta name="twitter:description" content="{$meta_description}" />
+<meta name="twitter:creator" content="@official_php" />
+<meta name="twitter:image:src" content="{$meta_image_path}" />
+
+<meta itemprop="name" content="PHP 8.2 Released" />
+<meta itemprop="description" content="{$meta_description}" />
+<meta itemprop="image" content="{$meta_image_path}" />
+
+<meta property="og:image" content="{$meta_image_path}" />
+<meta property="og:description" content="{$meta_description}" />
+META
+ ]);
+}
+
+function language_chooser(string $currentLang): void {
+ $LANGUAGES = [
+ 'en' => 'English',
+ 'ru' => 'Russian',
+ ];
+
+ // Print out the form with all the options
+ echo '
+ <form action="" method="get" id="changelang"
name="changelang">
+ <fieldset>
+ <label for="changelang-langs">Change language:</label>
+ <select onchange="location = this.value + \'.php\'"
name="lang" id="changelang-langs">
+';
+
+ $tab = ' ';
+ foreach ($LANGUAGES as $lang => $text) {
+ $selected = ($lang === $currentLang) ? ' selected="selected"' :
'';
+ echo $tab, "<option
value='$lang'$selected>$text</option>\n";
+ }
+
+ echo ' </select>
+ </fieldset>
+ </form>
+';
+}
+
+function message($code, $language = 'en')
+{
+ $original = require __DIR__ . '/languages/en.php';
+ if (($language !== 'en') && file_exists(__DIR__ . '/languages/' .
$language . '.php')) {
+ $translation = require __DIR__ . '/languages/' . $language . '.php';
+ }
+
+ return $translation[$code] ?? $original[$code] ?? $code;
+}
diff --git a/releases/8.2/en.php b/releases/8.2/en.php
new file mode 100644
index 0000000000..aa9133cd7a
--- /dev/null
+++ b/releases/8.2/en.php
@@ -0,0 +1,5 @@
+<?php
+
+$lang = 'en';
+
+include_once __DIR__ . '/release.inc';
\ No newline at end of file
diff --git a/releases/8.2/index.php b/releases/8.2/index.php
new file mode 100644
index 0000000000..9e2d99f8ef
--- /dev/null
+++ b/releases/8.2/index.php
@@ -0,0 +1,5 @@
+<?php
+ $_SERVER['BASE_PAGE'] = 'releases/8.2/index.php';
+include (__DIR__ . '/../../include/site.inc');
+
+mirror_redirect('/releases/8.2/en.php');
diff --git a/releases/8.2/languages/en.php b/releases/8.2/languages/en.php
new file mode 100644
index 0000000000..39add58800
--- /dev/null
+++ b/releases/8.2/languages/en.php
@@ -0,0 +1,40 @@
+<?php
+
+return [
+ 'common_header' => 'PHP 8.2 is a major update of the PHP language. Readonly
classes, null, false, and true as stand-alone types, deprecated dynamic properties, performance
improvements and more',
+ 'documentation' => 'Doc',
+ 'main_title' => 'To be released tomorrow!',
+ 'main_subtitle' => 'PHP 8.2 is a major update of the PHP language.<br
class="display-none-md">It contains many new features, including readonly classes,
null, false, and true as stand-alone types, deprecated dynamic properties, performance improvements
and more.',
+ 'upgrade_now' => 'Upgrade to PHP 8.2 now!',
+ 'readonly_classes_title' => 'Readonly classes',
+ 'dnf_types_title' => 'Disjunctive Normal Form (DNF) Types',
+ 'dnf_types_description' => 'DNF types allow us to combine <a
href="/manual/en/language.types.type-system.php#language.types.type-system.composite.union">union</a>
and <a
href="/manual/en/language.types.type-system.php#language.types.type-system.composite.intersection">intersection</a>
types, following a strict rule: when combining union and intersection types, intersection types must
be grouped with brackets.',
+ 'null_false_true_types_title' => 'Allow <code>null</code>,
<code>false</code>, and <code>true</code> as stand-alone types',
+ 'random_title' => 'New "Random" extension',
+ 'random_description' => '<p>The "random" extension provides a
new object-oriented API to random number generation. Instead of relying on a globally seeded random
number generator (RNG) using the Mersenne Twister algorithm the object-oriented API provides several
classes ("Engine"s) providing access to modern algorithms that store their state within
objects to allow for multiple independent seedable sequences.</p>
+ <p>The <code>\Random\Randomizer</code> class provides a high level
interface to use the engine\'s randomness to generate a random integer, to shuffle an array or
string, to select random array keys and more.</p>',
+ 'constants_in_traits_title' => 'Constants in traits',
+ 'constants_in_traits_description' => 'You cannot access the constant through
the name of the trait, but, you can access the constant through the class that uses the
trait.',
+ 'deprecate_dynamic_properties_title' => 'Deprecate dynamic properties',
+ 'deprecate_dynamic_properties_description' => '<p>The creation of
dynamic properties is deprecated to help avoid mistakes and typos, unless the class opts in by using
the <code>#[\AllowDynamicProperties]</code> attribute. <code>stdClass</code>
allows dynamic properties.</p>
+ <p>Usage of the <code>__get</code>/<code>__set</code> magic
methods is not affected by this change.</p>',
+ 'new_classes_title' => 'New Classes, Interfaces, and Functions',
+ 'new_mysqli' => 'New <a
href="/manual/en/mysqli.execute-query.php"><code>mysqli_execute_query</code></a>
function and <a
href="/manual/en/mysqli.execute-query.php"><code>mysqli::execute_query</code></a>
method.',
+ 'new_attributes' => 'New <a
href="/manual/en/class.allow-dynamic-properties.php"><code>#[\AllowDynamicProperties]</code></a>
and <a
href="/manual/en/class.sensitive-parameter.php"><code>#[\SensitiveParameter]</code></a>
attributes.',
+ 'new_zip' => 'New <a
href="/manual/en/ziparchive.getstreamindex.php"><code>ZipArchive::getStreamIndex</code></a>,
<a
href="/manual/en/ziparchive.getstreamname.php"><code>ZipArchive::getStreamName</code></a>,
and <a
href="/manual/en/ziparchive.clearerror.php"><code>ZipArchive::clearError</code></a>
methods.',
+ 'new_reflection' => 'New <a
href="/manual/en/reflectionfunction.isanonymous.php"><code>ReflectionFunction::isAnonymous</code></a>
and <a
href="/manual/en/reflectionmethod.hasprototype.php"><code>ReflectionMethod::hasPrototype</code></a>
methods.',
+ 'new_functions' => 'New <a
href="/manual/en/function.curl_upkeep.php"><code>curl_upkeep</code></a>,
<a
href="/manual/en/function.memory-reset-peak-usage.php"><code>memory_reset_peak_usage</code></a>,
<a
href="/manual/en/function.ini-parse-quantity.php"><code>ini_parse_quantity</code></a>,
<a
href="/manual/en/function.libxml-get-external-entity-loader.php"><code>libxml_get_external_entity_loader</code></a>,
<a
href="/manual/en/function.sodium-crypto-stream-xchacha20-xor-ic.php"><code>sodium_crypto_stream_xchacha20_xor_ic</code></a>,
<a
href="/manual/en/function.openssl-cipher-key-length.php"><code>openssl_cipher_key_length</code></a>
functions.',
+ 'bc_title' => 'Deprecations and backward compatibility breaks',
+ 'bc_string_interpolation' => 'Deprecated <code>${}</code> string
interpolation.',
+ 'bc_utf8' => 'Deprecated <a
href="/manual/en/function.utf8-encode.php"><code>utf8_encode</code></a>
and <a
href="/manual/en/function.utf8-decode.php"><code>utf8_decode</code></a>
functions.',
+ 'bc_datetime' => 'Methods <a
href="/manual/en/datetime.createfromimmutable.php"><code>DateTime::createFromImmutable</code></a>
and <a
href="/manual/en/datetimeimmutable.createfrommutable.php"><code>DateTimeImmutable::createFromMutable</code></a>
has a tentative return type of <code>static</code>.',
+ 'bc_odbc' => 'Extensions <code>ODBC</code> and
<code>PDO_ODBC</code> escapes the username and password.',
+ 'bc_str_locale_sensitive' => 'Functions <a
href="/manual/en/function.strtolower.php"><code>strtolower</code></a>
and <a
href="/manual/en/function.strtoupper.php"><code>strtoupper</code></a>
are no longer locale-sensitive.',
+ 'bc_spl_enforces_signature' => 'Methods <a
href="/manual/en/splfileobject.getcsvcontrol.php"><code>SplFileObject::getCsvControl</code></a>,
<a
href="/manual/en/splfileobject.fflush.php"><code>SplFileObject::fflush</code></a>,
<a
href="/manual/en/splfileobject.ftell.php"><code>SplFileObject::ftell</code></a>,
<a
href="/manual/en/splfileobject.fgetc.php"><code>SplFileObject::fgetc</code></a>,
and <a
href="/manual/en/splfileobject.fpassthru.php"><code>SplFileObject::fpassthru</code></a>
enforces their signature.',
+ 'bc_spl_false' => 'Method <a
href="/manual/en/splfileobject.haschildren.php"><code>SplFileObject::hasChildren</code></a>
has a tentative return type of <code>false</code>.',
+ 'bc_spl_null' => 'Method <a
href="/manual/en/splfileobject.getchildren.php"><code>SplFileObject::getChildren</code></a>
has a tentative return type of <code>null</code>.',
+ 'bc_spl_deprecated' => 'The internal method
<code>SplFileInfo::_bad_state_ex</code> has been deprecated.',
+ 'footer_title' => 'Better performance, better syntax, improved type
safety.',
+ 'footer_description' => '<p>For source downloads of PHP 8.2 please
visit the <a href="/downloads">downloads</a> page. Windows binaries can be
found on the <a href="https://windows.php.net/download">PHP for
Windows</a> site. The list of changes is recorded in the <a
href="/ChangeLog-8.php#PHP_8_2">ChangeLog</a>.</p>
+ <p>The <a href="/manual/en/migration82.php">migration guide</a>
is available in the PHP Manual. Please consult it for a detailed list of new features and
backward-incompatible changes.</p>',
+];
diff --git a/releases/8.2/languages/ru.php b/releases/8.2/languages/ru.php
new file mode 100644
index 0000000000..6cbb51d636
--- /dev/null
+++ b/releases/8.2/languages/ru.php
@@ -0,0 +1,40 @@
+<?php
+
+return [
+ 'common_header' => 'PHP 8.2 — большое обновление
языка PHP. Readonly-классы, самостоятельные типы null, false и true,
устаревшие динамические свойства, улучшение
производительности и многое другое.',
+ 'documentation' => 'Документация',
+ 'main_title' => 'будет выпущен завтра!',
+ 'main_subtitle' => 'PHP 8.2 — большое обновление
языка PHP.<br class="display-none-md">Оно содержит
множество новых возможностей, включая readonly-классы,
самостоятельные типы null, false и true, устаревшие
динамические свойства, улучшение производительности
и многое другое.',
+ 'upgrade_now' => 'Переходите на PHP 8.2!',
+ 'readonly_classes_title' => 'Readonly-классы',
+ 'dnf_types_title' => 'Типы в виде дизъюнктивной
нормальной формы (ДНФ)',
+ 'dnf_types_description' => 'ДНФ позволяет совместить
<a
href="/manual/ru/language.types.type-system.php#language.types.type-system.composite.union">объединение</a>
и <a
href="/manual/ru/language.types.type-system.php#language.types.type-system.composite.intersection">пересечение</a>
типов, при этом обязательно типы пересечения следует
сгруппировать скобками.',
+ 'null_false_true_types_title' => 'Самостоятельные типы
<code>null</code>, <code>false</code> и
<code>true</code>',
+ 'random_title' => 'Новый модуль "Random"',
+ 'random_description' => '<p>Модуль "random"
предлагает новый объектно-ориентированный API для
генерации случайных чисел. Вместо использования
глобального генератора случайных чисел (ГСЧ) на базе
алгоритма вихря Мерсенна, в объектно-ориентированном
API доступно несколько ГСЧ, представленных отдельными
классами (как реализации интерфейса Engine), которые
хранят внутреннее состояние, позволяя создавать
несколько независимых последовательностей случайных
чисел.</p>
+ <p>Класс <code>\Random\Randomizer</code> представляет
высокоуровневый интерфейс по использованию движков
для генерации случайного целого числа, перемешивания
массива или строки, выбора случайных ключей массива и
многое другое.</p>',
+ 'constants_in_traits_title' => 'Константы в трейтах',
+ 'constants_in_traits_description' => 'Нельзя получить
доступ к константе через имя трейта, но можно через
класс, который использует этот трейт.',
+ 'deprecate_dynamic_properties_title' => 'Динамические
свойства объявлены устаревшими',
+ 'deprecate_dynamic_properties_description' => '<p>Чтобы
помочь избежать ошибок и опечаток, больше не
рекомендуется определять динамические свойства,
только если сам класс явно не разрешит это при помощи
атрибута <code>#[\AllowDynamicProperties]</code>. В экземплярах
<code>stdClass</code> по-прежнему можно использовать
динамические свойства.</p>
+ <p>Это изменение не влияет на использование
магических методов
<code>__get</code>/<code>__set</code>.</p>',
+ 'new_classes_title' => 'Новые классы, интерфейсы и
функции',
+ 'new_mysqli' => 'Новая функция <a
href="/manual/ru/mysqli.execute-query.php"><code>mysqli_execute_query</code></a>
и метод <a
href="/manual/ru/mysqli.execute-query.php"><code>mysqli::execute_query</code></a>.',
+ 'new_attributes' => 'Новые атрибуты <a
href="/manual/ru/class.allow-dynamic-properties.php"><code>#[\AllowDynamicProperties]</code></a>
и <a
href="/manual/ru/class.sensitive-parameter.php"><code>#[\SensitiveParameter]</code></a>.',
+ 'new_zip' => 'Новые методы <a
href="/manual/ru/ziparchive.getstreamindex.php"><code>ZipArchive::getStreamIndex</code></a>,
<a
href="/manual/ru/ziparchive.getstreamname.php"><code>ZipArchive::getStreamName</code></a>
и <a
href="/manual/ru/ziparchive.clearerror.php"><code>ZipArchive::clearError</code></a>.',
+ 'new_reflection' => 'Новые методы <a
href="/manual/ru/reflectionfunction.isanonymous.php"><code>ReflectionFunction::isAnonymous</code></a>
и <a
href="/manual/ru/reflectionmethod.hasprototype.php"><code>ReflectionMethod::hasPrototype</code></a>.',
+ 'new_functions' => 'Новые функции <a
href="/manual/ru/function.curl_upkeep.php"><code>curl_upkeep</code></a>,
<a
href="/manual/ru/function.memory-reset-peak-usage.php"><code>memory_reset_peak_usage</code></a>,
<a
href="/manual/ru/function.ini-parse-quantity.php"><code>ini_parse_quantity</code></a>,
<a
href="/manual/ru/function.libxml-get-external-entity-loader.php"><code>libxml_get_external_entity_loader</code></a>,
<a
href="/manual/ru/function.sodium-crypto-stream-xchacha20-xor-ic.php"><code>sodium_crypto_stream_xchacha20_xor_ic</code></a>,
<a
href="/manual/ru/function.openssl-cipher-key-length.php"><code>openssl_cipher_key_length</code></a>.',
+ 'bc_title' => 'Устаревшая функциональность и
изменения в обратной совместимости',
+ 'bc_string_interpolation' => 'Интерполяции строк вида
<code>${}</code> следует избегать.',
+ 'bc_utf8' => 'Не рекомендуется использовать
функции <a
href="/manual/ru/function.utf8-encode.php"><code>utf8_encode</code></a>
и <a
href="/manual/ru/function.utf8-decode.php"><code>utf8_decode</code></a>.',
+ 'bc_datetime' => 'У методов <a
href="/manual/ru/datetime.createfromimmutable.php"><code>DateTime::createFromImmutable</code></a>
и <a
href="/manual/ru/datetimeimmutable.createfrommutable.php"><code>DateTimeImmutable::createFromMutable</code></a>
задан предварительный тип возвращаемого значения
<code>static</code>.',
+ 'bc_odbc' => 'Модули <code>ODBC</code> и
<code>PDO_ODBC</code> экранирует имя пользователя и
пароль.',
+ 'bc_str_locale_sensitive' => 'При работе функции <a
href="/manual/ru/function.strtolower.php"><code>strtolower</code></a>
и <a
href="/manual/ru/function.strtoupper.php"><code>strtoupper</code></a>
теперь не учитывают локаль.',
+ 'bc_spl_enforces_signature' => 'Методы <a
href="/manual/ru/splfileobject.getcsvcontrol.php"><code>SplFileObject::getCsvControl</code></a>,
<a
href="/manual/ru/splfileobject.fflush.php"><code>SplFileObject::fflush</code></a>,
<a
href="/manual/ru/splfileobject.ftell.php"><code>SplFileObject::ftell</code></a>,
<a
href="/manual/ru/splfileobject.fgetc.php"><code>SplFileObject::fgetc</code></a>
и <a
href="/manual/ru/splfileobject.fpassthru.php"><code>SplFileObject::fpassthru</code></a>
усиливают свою сигнатуру.',
+ 'bc_spl_false' => 'У метода <a
href="/manual/ru/splfileobject.haschildren.php"><code>SplFileObject::hasChildren</code></a>
предварительный тип возвращаемого значения задан как
<code>false</code>.',
+ 'bc_spl_null' => 'У метода <a
href="/manual/ru/splfileobject.getchildren.php"><code>SplFileObject::getChildren</code></a>
предварительный тип возвращаемого значения задан как
<code>null</code>.',
+ 'bc_spl_deprecated' => 'Внутренний метод
<code>SplFileInfo::_bad_state_ex</code> объявлен устаревшим.',
+ 'footer_title' => 'Выше производительность, лучше
синтаксис, надёжнее система типов.',
+ 'footer_description' => '<p>Для загрузки исходного
кода PHP 8.2 посетите страницу <a
href="/downloads">Downloads</a>. Бинарные файлы Windows
находятся на сайте <a href="https://windows.php.net/download">PHP for
Windows</a>. Список изменений перечислен на странице <a
href="/ChangeLog-8.php#PHP_8_2">ChangeLog</a>.</p>
+ <p><a href="/manual/ru/migration82.php">Руководство по
миграции</a> доступно в разделе документации.
Ознакомьтесь с ним, чтобы узнать обо всех новых
возможностях и изменениях, затрагивающих обратную
совместимость.</p>',
+];
diff --git a/releases/8.2/release.inc b/releases/8.2/release.inc
new file mode 100644
index 0000000000..dcab6314fb
--- /dev/null
+++ b/releases/8.2/release.inc
@@ -0,0 +1,426 @@
+<?php
+
+use function releases\php82\common_header;
+use function releases\php82\language_chooser;
+use function releases\php82\language_redirect;
+use function releases\php82\message;
+
+if (!isset($lang)) {
+ $lang = 'en';
+}
+
+$_SERVER['BASE_PAGE'] = 'releases/8.2/' . $lang . '.php';
+
+include_once __DIR__ . '/common.php';
+
+language_redirect($lang);
+
+common_header(message('common_header', $lang));
+
+?>
+ <section class="php8-section php8-section_dark php8-section_header center">
+ <div class="page-tools">
+ <div class="change-language">
+ <?php language_chooser($lang); ?>
+ </div>
+ </div>
+ <div class="php8-section__content">
+ <div class="php8-logo">
+ <img src="/images/php8/logo_php8_2.svg" alt="PHP 8.2"
height="126" width="343">
+ </div>
+ <div class="php8-title"><?= message('main_title', $lang)
?></div>
+ <div class="php8-subtitle"><?= message('main_subtitle',
$lang) ?></div>
+ <div class="php8-button-wrapper center">
+ <a class="php8-button php8-button_light"
href="/downloads"><?= message('upgrade_now', $lang) ?></a>
+ </div>
+ </div>
+ </section>
+
+ <section class="php8-section center">
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="readonly_classes">
+ <?= message('readonly_classes_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/readonly_classes">RFC</a>
+ <a class="php8-rfc"
+ href="/manual/<?= $lang
?>/language.oop5.basic.php#language.oop5.basic.class.readonly"><?= message(
+ 'documentation',
+ $lang
+ ) ?></a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP < 8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class BlogData
+{
+ public readonly string $title;
+
+ public readonly Status $status;
+
+ public function __construct(string $title, Status $status)
+ {
+ $this->title = $title;
+ $this->status = $status;
+ }
+}
+PHP
+
+ ); ?>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+readonly class BlogData
+{
+ public string $title;
+
+ public Status $status;
+
+ public function __construct(string $title, Status $status)
+ {
+ $this->title = $title;
+ $this->status = $status;
+ }
+}
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="dnf_types">
+ <?= message('dnf_types_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/dnf_types">RFC</a>
+ <a class="php8-rfc"
+ href="/manual/<?= $lang
?>/migration82.new-features.php#migration82.new-features.core.type-system"><?=
message(
+ 'documentation',
+ $lang
+ ) ?></a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP < 8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class Foo {
+ public function bar(mixed $entity) {
+ if ($entity === null) {
+ return null;
+ }
+
+ if (($entity instanceof A) && ($entity instanceof B)) {
+ return $entity;
+ }
+
+ throw new Exception('Invalid entity');
+ }
+}
+PHP
+
+ ); ?>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class Foo {
+ public function bar((A&B)|null $entity) {
+ if ($entity === null) {
+ return null;
+ }
+
+ return $entity;
+ }
+}
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <?= message('dnf_types_description', $lang) ?>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="null_false_true_types">
+ <?= message('null_false_true_types_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/null-false-standalone-types">RFC</a>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/true-type">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP < 8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class Falsy
+{
+ public function almostFalse(): string|bool { /* ... */ *}
+
+ public function almostTrue(): string|bool { /* ... */ *}
+
+ public function almostNull(): string|null { /* ... */ *}
+}
+PHP
+
+ ); ?>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class Falsy
+{
+ public function alwaysFalse(): false { /* ... */ *}
+
+ public function alwaysTrue(): true { /* ... */ *}
+
+ public function alwaysNull(): null { /* ... */ *}
+}
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="random_extension">
+ <?= message('random_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/rng_extension">RFC</a>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/random_extension_improvement">RFC</a>
+ <a class="php8-rfc" href="/manual/<?= $lang
?>/book.random.php"><?= message('documentation', $lang ) ?></a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="example-contents example-contents-full">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+use Random\Engine\Xoshiro256StarStar;
+use Random\Randomizer;
+
+$blueprintRng = new Xoshiro256StarStar(
+ hash('sha256', "Example seed that is converted to a 256 Bit string via
SHA-256", true)
+);
+
+$fibers = [];
+for ($i = 0; $i < 8; $i++) {
+ $fiberRng = clone $blueprintRng;
+ // Xoshiro256**'s 'jump()' method moves the blueprint ahead 2**128 steps, as if
calling
+ // 'generate()' 2**128 times, giving the Fiber 2**128 unique values without needing to
reseed.
+ $blueprintRng->jump();
+
+ $fibers[] = new Fiber(function () use ($fiberRng, $i): void {
+ $randomizer = new Randomizer($fiberRng);
+
+ echo "{$i}: " . $randomizer->getInt(0, 100), PHP_EOL;
+ });
+}
+
+// The randomizer will use a CSPRNG by default.
+$randomizer = new Randomizer();
+
+// Even though the fibers execute in a random order, they will print the same value
+// each time, because each has its own unique instance of the RNG.
+$fibers = $randomizer->shuffleArray($fibers);
+foreach ($fibers as $fiber) {
+ $fiber->start();
+}
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <?= message('random_description', $lang) ?>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="constants_in_traits">
+ <?= message('constants_in_traits_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/constants_in_traits">RFC</a>
+ <a class="php8-rfc"
+ href="/manual/<?= $lang
?>/migration82.new-features.php#migration82.new-features.core.constant-in-traits"><?=
message(
+ 'documentation',
+ $lang
+ ) ?></a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP < 8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+trait Foo
+{
+ public const CONSTANT = 1;
+
+ public function bar(): int
+ {
+ return self::CONSTANT; // Fatal error
+ }
+}
+
+class Bar
+{
+ use Foo;
+}
+PHP
+
+ ); ?>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+trait Foo
+{
+ public const CONSTANT = 1;
+
+ public function bar(): int
+ {
+ return self::CONSTANT; // Fatal error
+ }
+}
+
+class Bar
+{
+ use Foo;
+}
+
+var_dump(Bar::CONSTANT); // 1
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <?= message('constants_in_traits_description', $lang) ?>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="deprecate_dynamic_properties">
+ <?= message('deprecate_dynamic_properties_title', $lang) ?>
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/deprecate_dynamic_properties">RFC</a>
+ <a class="php8-rfc"
+ href="/manual/<?= $lang
?>/migration82.deprecated.php#migration82.deprecated.core.dynamic-properties"><?=
message(
+ 'documentation',
+ $lang
+ ) ?></a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP < 8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class User
+{
+ public $name;
+}
+
+$user = new User();
+$user->last_name = 'Doe';
+
+$user = new stdClass();
+$user->last_name = 'Doe';
+PHP
+
+ ); ?>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP
8.2</div>
+ <div class="php8-code phpcode">
+ <?php highlight_php_trimmed(
+ <<<'PHP'
+class User
+{
+ public $name;
+}
+
+$user = new User();
+$user->last_name = 'Doe'; // Deprecated notice
+
+$user = new stdClass();
+$user->last_name = 'Doe'; // Still allowed
+PHP
+ ); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <?= message('deprecate_dynamic_properties_description', $lang) ?>
+ </div>
+
+ </section>
+
+ <section class="php8-section center php8-section_light php8-columns">
+ <div class="php8-column">
+ <h2 class="php8-h2" id="other_new_things"><?=
message('new_classes_title', $lang) ?></h2>
+ <div class="php8-compare__content php8-compare__content--block">
+ <ul>
+ <li><?= message('new_mysqli', $lang) ?></li>
+ <li><?= message('new_attributes', $lang) ?></li>
+ <li><?= message('new_zip', $lang) ?></li>
+ <li><?= message('new_reflection', $lang) ?></li>
+ <li><?= message('new_functions', $lang) ?></li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="php8-column">
+ <h2 class="php8-h2" id="deprecations_and_bc_breaks"><?=
message('bc_title', $lang) ?></h2>
+ <div class="php8-compare__content">
+ <ul>
+ <li><?= message('bc_string_interpolation', $lang)
?></li>
+ <li><?= message('bc_utf8', $lang) ?></li>
+ <li><?= message('bc_datetime', $lang) ?></li>
+ <li><?= message('bc_odbc', $lang) ?></li>
+ <li><?= message('bc_str_locale_sensitive', $lang)
?></li>
+ <li><?= message('bc_spl_enforces_signature', $lang)
?></li>
+ <li><?= message('bc_spl_false', $lang) ?></li>
+ <li><?= message('bc_spl_null', $lang) ?></li>
+ <li><?= message('bc_spl_deprecated', $lang) ?></li>
+ </ul>
+ </div>
+ </div>
+ </section>
+
+ <section class="php8-section php8-section_dark php8-section_footer
php8-footer">
+ <div class="php8-section__content">
+ <h2 class="php8-h2 center"><?= message('footer_title',
$lang) ?></h2>
+ <div class="php8-button-wrapper center">
+ <a class="php8-button php8-button_light"
href="/downloads"><?= message('upgrade_now', $lang) ?></a>
+ </div>
+ <div class="php8-footer__content"><?=
message('footer_description', $lang) ?></div>
+ </div>
+ </section>
+
+<?php
+
+site_footer();
diff --git a/releases/8.2/ru.php b/releases/8.2/ru.php
new file mode 100644
index 0000000000..4aefaf9a8c
--- /dev/null
+++ b/releases/8.2/ru.php
@@ -0,0 +1,5 @@
+<?php
+
+$lang = 'ru';
+
+include_once __DIR__ . '/release.inc';
diff --git a/styles/php8.css b/styles/php8.css
index 9de2cb73c1..e10d230bf5 100644
--- a/styles/php8.css
+++ b/styles/php8.css
@@ -285,6 +285,7 @@
}
}
+.php8-h2 code,
.php8-compare__content code {
color: rgba(39, 40, 44, 0.7);
background-color: rgba(39, 40, 44, 0.05);
@@ -435,3 +436,8 @@
color: rgba(39, 40, 44, 0.7);
line-height: 1.33;
}
+
+.example-contents-full {
+ width: 100%;
+ position: relative;
+}