Skip to content

Commit 2f88bae

Browse files
saundefinedpronskiyTimWollalex111
authored
Preview PHP 8.2 Release page (#675)
Co-authored-by: Roman Pronskiy <[email protected]> Co-authored-by: Tim Düsterhus <[email protected]> Co-authored-by: Alexey Pyltsyn <[email protected]>
1 parent 73d24e3 commit 2f88bae

File tree

10 files changed

+634
-0
lines changed

10 files changed

+634
-0
lines changed

images/php8/logo_php8_2.svg

+32
Loading

images/php8/php_8_2_released.png

9.65 KB
Loading

releases/8.2/common.php

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace releases\php82;
4+
5+
include_once __DIR__ . '/../../include/prepend.inc';
6+
7+
function language_redirect(string $currentLang): void {
8+
// We don't use the general language selection of php.net,
9+
// so soldier on with this one.
10+
return;
11+
}
12+
13+
function common_header(string $description): void {
14+
global $MYSITE;
15+
16+
$meta_image_path = \htmlspecialchars(
17+
\filter_var($MYSITE . 'images/php8/php_8_2_released.png', \FILTER_VALIDATE_URL));
18+
$meta_description = \htmlspecialchars($description);
19+
20+
\site_header("PHP 8.2.0 Release Announcement", [
21+
'current' => 'php8',
22+
'css' => ['php8.css'],
23+
'meta_tags' => <<<META
24+
<meta name="twitter:card" content="summary_large_image" />
25+
<meta name="twitter:site" content="@official_php" />
26+
<meta name="twitter:title" content="PHP 8.2 Released" />
27+
<meta name="twitter:description" content="{$meta_description}" />
28+
<meta name="twitter:creator" content="@official_php" />
29+
<meta name="twitter:image:src" content="{$meta_image_path}" />
30+
31+
<meta itemprop="name" content="PHP 8.2 Released" />
32+
<meta itemprop="description" content="{$meta_description}" />
33+
<meta itemprop="image" content="{$meta_image_path}" />
34+
35+
<meta property="og:image" content="{$meta_image_path}" />
36+
<meta property="og:description" content="{$meta_description}" />
37+
META
38+
]);
39+
}
40+
41+
function language_chooser(string $currentLang): void {
42+
$LANGUAGES = [
43+
'en' => 'English',
44+
'ru' => 'Russian',
45+
];
46+
47+
// Print out the form with all the options
48+
echo '
49+
<form action="" method="get" id="changelang" name="changelang">
50+
<fieldset>
51+
<label for="changelang-langs">Change language:</label>
52+
<select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs">
53+
';
54+
55+
$tab = ' ';
56+
foreach ($LANGUAGES as $lang => $text) {
57+
$selected = ($lang === $currentLang) ? ' selected="selected"' : '';
58+
echo $tab, "<option value='$lang'$selected>$text</option>\n";
59+
}
60+
61+
echo ' </select>
62+
</fieldset>
63+
</form>
64+
';
65+
}
66+
67+
function message($code, $language = 'en')
68+
{
69+
$original = require __DIR__ . '/languages/en.php';
70+
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
71+
$translation = require __DIR__ . '/languages/' . $language . '.php';
72+
}
73+
74+
return $translation[$code] ?? $original[$code] ?? $code;
75+
}

releases/8.2/en.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang = 'en';
4+
5+
include_once __DIR__ . '/release.inc';

releases/8.2/index.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$_SERVER['BASE_PAGE'] = 'releases/8.2/index.php';
3+
include (__DIR__ . '/../../include/site.inc');
4+
5+
mirror_redirect('/releases/8.2/en.php');

releases/8.2/languages/en.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
return [
4+
'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',
5+
'documentation' => 'Doc',
6+
'main_title' => 'To be released tomorrow!',
7+
'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.',
8+
'upgrade_now' => 'Upgrade to PHP 8.2 now!',
9+
'readonly_classes_title' => 'Readonly classes',
10+
'dnf_types_title' => 'Disjunctive Normal Form (DNF) Types',
11+
'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.',
12+
'null_false_true_types_title' => 'Allow <code>null</code>, <code>false</code>, and <code>true</code> as stand-alone types',
13+
'random_title' => 'New "Random" extension',
14+
'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>
15+
<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>',
16+
'constants_in_traits_title' => 'Constants in traits',
17+
'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.',
18+
'deprecate_dynamic_properties_title' => 'Deprecate dynamic properties',
19+
'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>
20+
<p>Usage of the <code>__get</code>/<code>__set</code> magic methods is not affected by this change.</p>',
21+
'new_classes_title' => 'New Classes, Interfaces, and Functions',
22+
'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.',
23+
'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.',
24+
'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.',
25+
'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.',
26+
'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.',
27+
'bc_title' => 'Deprecations and backward compatibility breaks',
28+
'bc_string_interpolation' => 'Deprecated <code>${}</code> string interpolation.',
29+
'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.',
30+
'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>.',
31+
'bc_odbc' => 'Extensions <code>ODBC</code> and <code>PDO_ODBC</code> escapes the username and password.',
32+
'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.',
33+
'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.',
34+
'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>.',
35+
'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>.',
36+
'bc_spl_deprecated' => 'The internal method <code>SplFileInfo::_bad_state_ex</code> has been deprecated.',
37+
'footer_title' => 'Better performance, better syntax, improved type safety.',
38+
'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>
39+
<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>',
40+
];

0 commit comments

Comments
 (0)