Author: Theodore Brown (theodorejb)
Committer: GitHub (web-flow)
Pusher: saundefined
Date: 2025-11-04T23:36:34+03:00

Commit: 
https://github.com/php/web-php/commit/eac11c7036feca7aa00090b51e027aead89bec41
Raw diff: 
https://github.com/php/web-php/commit/eac11c7036feca7aa00090b51e027aead89bec41.diff

Revamp PHP 8.5 examples and content (#31)

* Simplified header and footer text.
* Moved Pipe Operator example to the top and simplified the code and 
description slightly.
* Made the URI Extension description less wordy.
* Replaced the *Clone With* example to have a realistic before/after class 
(rather than a fatal error in the before example).
* Greatly simplified the `array_first()` example and moved it to after the 
`#[\NoDiscard]` attribute.
* Replaced the *Closures and First Class Callables in Constant Expressions* 
example with a couple self-contained functions highlighting the new syntax 
(rather than a complex test which isn't even supported in PHPUnit). Also added 
a description.
* Shortened and clarified the *Persistent cURL Share Handles* example and added 
a more helpful description.
* Filled out the *Deprecations and backward compatibility breaks* section.
* Replaced *New Classes, Interfaces, and Functions* section with a more 
relevant *Additional features and improvements* section (mentioning that fatal 
errors now include a backtrace, that `setcookie()` and `setrawcookie()` now 
support the "partitioned" key, and clarifying some of the other new 
functions/features).

Changed paths:
  M  releases/8.5/languages/en.php
  M  releases/8.5/release.inc


Diff:

diff --git a/releases/8.5/languages/en.php b/releases/8.5/languages/en.php
index 3ac7f87c20..7f3011b05c 100644
--- a/releases/8.5/languages/en.php
+++ b/releases/8.5/languages/en.php
@@ -1,29 +1,31 @@
 <?php
 
 return [
-    'common_header' => 'PHP 8.5 is a major update of the PHP language. It 
contains many new features, such as the new URI extension, support for 
modifying properties while cloning, the Pipe operator, performance 
improvements, bug fixes, and general cleanup.',
+    'common_header' => 'PHP 8.5 is a major update of the PHP language, with 
new features including the Pipe Operator, URI extension, and support for 
modifying properties while cloning.',
     'documentation' => 'Doc',
     'main_title' => 'Released!',
-    'main_subtitle' => 'PHP 8.5 is a major update of the PHP language.<br 
class="display-none-md"> It contains many new features, such as the new URI 
extension, support for modifying properties while cloning, the Pipe operator, 
performance improvements, bug fixes, and general cleanup.',
-    'upgrade_now' => 'Upgrade to PHP 8.5 now!',
+    'main_subtitle' => 'PHP 8.5 is a major update of the PHP language, with 
new features including the Pipe Operator, URI extension, and support for 
modifying properties while cloning.',
+    'upgrade_now' => 'Upgrade to PHP 8.5',
 
     'pipe_operator_title' => 'Pipe Operator',
-    'pipe_operator_description' => '<p>The pipe operator allows chaining 
function calls together without dealing with intermediary variables. That can 
be especially helpful when replacing many "nested calls" with a chain that can 
be read forwards, rather than inside-out.</p><p>Learn more about the backstory 
of this feature in <a 
href="https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/"; 
target="_blank" rel="noopener noreferrer">The PHP Foundation’s blog</a>.</p>',
-    'url_parsing_api_title' => 'New URI Extension',
-    'url_parsing_api_description' => '<p>As an always-available part of PHP\'s 
standard library the new URI extension provides APIs to parse and modify URIs 
and URLs according to the RFC 3986 and the WHATWG URL standards.</p><p>The 
secure and standards-compliant URI parsing is powered by the <a 
href="https://uriparser.github.io/";>uriparser</a> (RFC 3986) and <a 
href="https://lexbor.com/";>Lexbor</a> (WHATWG URL) libraries.</p><p>Learn more 
about the backstory of this feature in <a 
href="https://thephp.foundation/blog/2025/10/10/php-85-uri-extension/"; 
target="_blank" rel="noopener noreferrer">The PHP Foundation’s blog</a>.</p>',
+    'pipe_operator_description' => '<p>The pipe operator allows chaining 
function calls together without dealing with intermediary variables. This 
enables replacing many "nested calls" with a chain that can be read forwards, 
rather than inside-out.</p><p>Learn more about the backstory of this feature in 
<a href="https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/"; 
target="_blank" rel="noopener noreferrer">The PHP Foundation’s blog</a>.</p>',
+    'uri_extension_title' => 'URI Extension',
+    'uri_extension_description' => '<p>The new always-available URI extension 
provides APIs to securely parse and modify URIs and URLs according to the RFC 
3986 and the WHATWG URL standards.</p><p>Powered by the <a 
href="https://uriparser.github.io/";>uriparser</a> (RFC 3986) and <a 
href="https://lexbor.com/";>Lexbor</a> (WHATWG URL) libraries.</p><p>Learn more 
about the backstory of this feature in <a 
href="https://thephp.foundation/blog/2025/10/10/php-85-uri-extension/"; 
target="_blank" rel="noopener noreferrer">The PHP Foundation’s blog</a>.</p>',
     'clone_with_title' => 'Clone With',
-    'clone_with_description' => 'It is now possible to update properties 
during object cloning by passing an associative array with the updated to the 
<code>clone()</code> function. This enables straight-forward support of the 
"with-er" pattern for <code>readonly</code> classes.',
+    'clone_with_description' => 'It is now possible to update properties 
during object cloning by passing an associative array to the 
<code>clone()</code> function. This enables straightforward support of the 
"with-er" pattern for <code>readonly</code> classes.',
     'no_discard_title' => '<code>#[\NoDiscard]</code> Attribute',
-    'no_discard_description' => '<p>By adding the <code>#[\NoDiscard]</code> 
attribute to a function, PHP will check whether the returned value is consumed 
and emit a warning if it is not. This allows to improve the safety of APIs 
where the returned value is important, but where it is easy to forget using the 
return value by accident.</p><p>The associated <code>(void)</code> cast can be 
used to indicate that a value is intentionally unused.</p>',
-    'fcc_in_const_expr_title' => 'Closures and First Class Callables in 
Constant Expressions',
-    'curl_share_persistence_improvement_title' => 'Persistent cURL Share 
Handles',
-    'array_first_last_title' => 'New <code>array_first()</code> and 
<code>array_last()</code> functions',
+    'no_discard_description' => '<p>By adding the <code>#[\NoDiscard]</code> 
attribute to a function, PHP will check whether the returned value is consumed 
and emit a warning if it is not. This allows improving the safety of APIs where 
the returned value is important, but it\'s easy to forget using the return 
value by accident.</p><p>The associated <code>(void)</code> cast can be used to 
indicate that a value is intentionally unused.</p>',
+    'array_first_last_title' => '<code>array_first()</code> and 
<code>array_last()</code> functions',
+    'fcc_in_const_expr_title' => 'Closures and First-Class Callables in 
Constant Expressions',
+    'fcc_in_const_expr_description' => 'Static closures and first-class 
callables can now be used in constant expressions. This includes attribute 
parameters, default values of properties and parameters, and constants.',
+    'persistent_curl_share_handles_title' => 'Persistent cURL Share Handles',
+    'persistent_curl_share_handles_description' => 'Unlike 
<code>curl_share_init()</code>, handles created by 
<code>curl_share_init_persistent()</code> will not be destroyed at the end of 
the PHP request. If a persistent share handle with the same set of share 
options is found, it will be reused, avoiding the cost of initializing cURL 
handles each time.',
 
-    'new_classes_title' => 'New Classes, Interfaces, and Functions',
+    'new_classes_title' => 'Additional features and improvements',
 
     'bc_title' => 'Deprecations and backward compatibility breaks',
 
-    'footer_title' => 'Better performance, better syntax, improved type 
safety.',
-    'footer_description' => '<p>For source downloads of PHP 8.5 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_5">ChangeLog</a>.</p>
-        <p>The <a href="/manual/en/migration85.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>',
+    'footer_title' => 'Better syntax, improved performance and type safety.',
+    'footer_description' => '<p>The full list of changes is recorded in the <a 
href="/ChangeLog-8.php#PHP_8_5">ChangeLog</a>.</p>
+        <p>Please consult the <a href="/manual/en/migration85.php">Migration 
Guide</a> for a detailed list of new features and backward-incompatible 
changes.</p>',
 ];
diff --git a/releases/8.5/release.inc b/releases/8.5/release.inc
index 48a2f1abbc..46cb88c4d5 100644
--- a/releases/8.5/release.inc
+++ b/releases/8.5/release.inc
@@ -36,9 +36,9 @@ common_header(message('common_header', $lang));
 
     <section class="php8-section center">
         <div class="php8-compare">
-            <h2 class="php8-h2" id="url_parsing_api">
-                <?= message('url_parsing_api_title', $lang) ?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/url_parsing_api";>RFC</a>
+            <h2 class="php8-h2" id="pipe_operator">
+                <?= message('pipe_operator_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/pipe-operator-v3";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
@@ -46,41 +46,51 @@ common_header(message('common_header', $lang));
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-$components = parse_url('https://php.net/releases/8.4/en.php');
+$input = ' My test value. ';
 
-var_dump($components['host']);
-// string(7) "php.net"
+$output = strtolower(
+    str_replace('.', '',
+        str_replace(' ', '-',
+            trim($input)
+        )
+    )
+);
+
+var_dump($output); // string(13) "my-test-value"
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-use Uri\Rfc3986\Uri;
+$input = ' My test value. ';
 
-$uri = new Uri('https://php.net/releases/8.5/en.php');
+$output = $input
+    |> trim(...)
+    |> (fn($str) => str_replace(' ', '-', $str))
+    |> (fn($str) => str_replace('.', '', $str))
+    |> strtolower(...);
 
-var_dump($uri->getHost());
-// string(7) "php.net"
+var_dump($output); // string(13) "my-test-value"
 PHP
                         ); ?>
                     </div>
                 </div>
             </div>
             <div class="php8-compare__content">
-                <?= message('url_parsing_api_description', $lang) ?>
+                <?= message('pipe_operator_description', $lang) ?>
             </div>
         </div>
 
         <div class="php8-compare">
-            <h2 class="php8-h2" id="clone_with">
-                <?= message('clone_with_title', $lang) ?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/clone_with_v2";>RFC</a>
+            <h2 class="php8-h2" id="uri_extension">
+                <?= message('uri_extension_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/url_parsing_api";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
@@ -88,124 +98,102 @@ PHP
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-final readonly class PhpVersion
-{
-    public function __construct(
-        public string $version = 'PHP 8.4',
-    ) {}
-
-    public function withVersion(string $version): self
-    {
-        $newObject = clone $this;
-        $newObject->version = $version;
-
-        return $newObject;
-    }
-}
-
-$version = new PhpVersion();
-
-var_dump($version->version);
-// string(7) "PHP 8.4"
+$components = parse_url('https://php.net/releases/8.4/en.php');
 
-var_dump($version->withVersion('PHP 8.5')->version);
-// Fatal error: Uncaught Error: Cannot modify readonly property 
PhpVersion::$version
+var_dump($components['host']);
+// string(7) "php.net"
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-final readonly class PhpVersion
-{
-    public function __construct(
-        public string $version = 'PHP 8.4',
-    ) {}
-
-    public function withVersion(string $version): self
-    {
-        return clone($this, [
-            'version' => $version,
-        ]);
-    }
-}
-
-$version = new PhpVersion();
-
-var_dump($version->version);
-// string(7) "PHP 8.4"
+use Uri\Rfc3986\Uri;
 
-var_dump($version->withVersion('PHP 8.5')->version);
-// string(7) "PHP 8.5"
+$uri = new Uri('https://php.net/releases/8.5/en.php');
 
-var_dump($version->version);
-// string(7) "PHP 8.4"
+var_dump($uri->getHost());
+// string(7) "php.net"
 PHP
                         ); ?>
                     </div>
                 </div>
             </div>
             <div class="php8-compare__content">
-                <?= message('clone_with_description', $lang) ?>
+                <?= message('uri_extension_description', $lang) ?>
             </div>
         </div>
 
         <div class="php8-compare">
-            <h2 class="php8-h2" id="pipe_operator">
-                <?= message('pipe_operator_title', $lang) ?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/pipe-operator-v3";>RFC</a>
+            <h2 class="php8-h2" id="clone_with">
+                <?= message('clone_with_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/clone_with_v2";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label">PHP &lt; 8.5</div>
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
-                            <<<'PHP'
-$input = ' Some kind of string. ';
+                                <<<'PHP'
+readonly class Color
+{
+    public function __construct(
+        public int $red,
+        public int $green,
+        public int $blue,
+        public int $alpha = 255,
+    ) {}
 
-$output = strtolower(
-    str_replace(['.', '/', '…'], '',
-        str_replace(' ', '-',
-            trim($input)
-        )
-    )
-);
+    public function withAlpha(int $alpha): self
+    {
+        $values = get_object_vars($this);
+        $values['alpha'] = $alpha;
+        return new self(...$values);
+    }
+}
 
-var_dump($output);
-// string(19) "some-kind-of-string"
+$blue = new Color(79, 91, 147);
+$transparentBlue = $blue->withAlpha(128);
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
-                            <<<'PHP'
-$input = ' Some kind of string. ';
+                                <<<'PHP'
+readonly class Color
+{
+    public function __construct(
+        public int $red,
+        public int $green,
+        public int $blue,
+        public int $alpha = 255,
+    ) {}
 
-$output = $input
-    |> trim(...)
-    |> (fn($string) => str_replace(' ', '-', $string))
-    |> (fn($string) => str_replace(['.', '/', '…'], '', $string))
-    |> strtolower(...);
+    public function withAlpha(int $alpha): self
+    {
+        return clone($this, ['alpha' => $alpha]);
+    }
+}
 
-var_dump($output);
-// string(19) "some-kind-of-string"
+$blue = new Color(79, 91, 147);
+$transparentBlue = $blue->withAlpha(128);
 PHP
                         ); ?>
                     </div>
                 </div>
             </div>
             <div class="php8-compare__content">
-                <?= message('pipe_operator_description', $lang) ?>
+                <?= message('clone_with_description', $lang) ?>
             </div>
         </div>
 
@@ -225,16 +213,16 @@ function getPhpVersion(): string
        return 'PHP 8.4';
 }
 
-getPhpVersion(); // No Errors
+getPhpVersion(); // No warning
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
 #[\NoDiscard]
@@ -256,10 +244,9 @@ PHP
         </div>
 
         <div class="php8-compare">
-            <h2 class="php8-h2" id="fcc_in_const_expr">
-                <?= message('fcc_in_const_expr_title', $lang) ?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/fcc_in_const_expr";>RFC</a>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/closures_in_const_expr";>RFC</a>
+            <h2 class="php8-h2" id="array_first_last">
+                <?= message('array_first_last_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/array_first_last";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
@@ -267,62 +254,40 @@ PHP
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-final class CalculatorTest extends \PHPUnit\Framework\TestCase
-{
-    #[DataProvider('subtractionProvider')]
-    public function testSubtraction(
-        int $minuend,
-        int $subtrahend,
-        int $result
-    ): void
-    {
-        $this->assertSame(
-            $result,
-            Calculator::subtract($minuend, $subtrahend)
-        );
-    }
+$releases = [
+    '8.5' => '2025-11-20',
+    '8.4' => '2024-11-21',
+    '8.3' => '2023-11-23',
+    '8.2' => '2022-12-08',
+];
 
-    public static function subtractionProvider(): iterable
-    {
-        for ($i = -10; $i <= 10; $i++) {
-            yield [$i, $i, 0];
-            yield [$i, 0, $i];
-            yield [0, $i, -$i];
-        }
-    }
-}
+$firstKey = array_key_first($releases);
+$newestDate = $releases[$firstKey];
+
+var_dump($newestDate);
+// string(10) "2025-11-20"
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-final class CalculatorTest
-{
-    #[Test\CaseGenerator(static function (): iterable
-    {
-        for ($i = -10; $i <= 10; $i++) {
-            yield [$i, $i, 0];
-            yield [$i, 0, $i];
-            yield [0, $i, -$i];
-        }
-    })]
-    public function testSubtraction(
-        int $minuend,
-        int $subtrahend,
-        int $result
-    )
-    {
-        \assert(
-            Calculator::subtract($minuend, $subtrahend) === $result
-        );
-    }
-}
+$releases = [
+    '8.5' => '2025-11-20',
+    '8.4' => '2024-11-21',
+    '8.3' => '2023-11-23',
+    '8.2' => '2022-12-08',
+];
+
+$newestDate = array_first($releases);
+
+var_dump($newestDate);
+// string(10) "2025-11-20"
 PHP
                         ); ?>
                     </div>
@@ -331,10 +296,10 @@ PHP
         </div>
 
         <div class="php8-compare">
-            <h2 class="php8-h2" id="curl_share_persistence_improvement">
-                <?= message('curl_share_persistence_improvement_title', $lang) 
?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/curl_share_persistence";>RFC</a>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/curl_share_persistence_improvement";>RFC</a>
+            <h2 class="php8-h2" id="fcc_in_const_expr">
+                <?= message('fcc_in_const_expr_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/closures_in_const_expr";>RFC</a>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/fcc_in_const_expr";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
@@ -342,54 +307,58 @@ PHP
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-$sh = curl_share_init();
-curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
-curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
+function increment(
+    int $value,
+    ?Closure $incrementer = null,
+): int {
+    if ($incrementer === null) {
+        $incrementer = addOne(...);
+    }
 
-$ch1 = curl_init('https://php.net/');
-curl_setopt($ch1, CURLOPT_SHARE, $sh);
-curl_exec($ch1);
+    return $incrementer($value);
+}
 
-$ch2 = curl_init('https://thephp.foundation/');
-curl_setopt($ch2, CURLOPT_SHARE, $sh);
-curl_exec($ch2);
+function addOne(int $value): int
+{
+    return $value + 1;
+}
 PHP
 
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-$sh = curl_share_init_persistent([
-    CURL_LOCK_DATA_DNS,
-    CURL_LOCK_DATA_CONNECT
-]);
-
-$ch1 = curl_init('https://php.net/');
-curl_setopt($ch1, CURLOPT_SHARE, $sh);
-curl_exec($ch1);
+function increment(
+    int $value,
+    Closure $incrementer = addOne(...),
+): int {
+    return $incrementer($value);
+}
 
-$ch2 = curl_init('https://thephp.foundation/');
-curl_setopt($ch2, CURLOPT_SHARE, $sh);
-curl_exec($ch2);
+function addOne(int $value): int
+{
+    return $value + 1;
+}
 PHP
                         ); ?>
                     </div>
                 </div>
             </div>
             <div class="php8-compare__content">
-                New <code>CurlSharePersistentHandle</code> class, 
<code>curl_multi_get_handles()</code>, 
<code>curl_share_init_persistent()</code> functions are available.
+                <?= message('fcc_in_const_expr_description', $lang) ?>
             </div>
         </div>
 
         <div class="php8-compare">
-            <h2 class="php8-h2" id="array_first_last">
-                <?= message('array_first_last_title', $lang) ?>
-                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/array_first_last";>RFC</a>
+            <h2 class="php8-h2" id="curl_share_persistence_improvement">
+                <?= message('persistent_curl_share_handles_title', $lang) ?>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/curl_share_persistence";>RFC</a>
+                <a class="php8-rfc" 
href="https://wiki.php.net/rfc/curl_share_persistence_improvement";>RFC</a>
             </h2>
             <div class="php8-compare__main">
                 <div class="php8-compare__block example-contents">
@@ -397,53 +366,42 @@ PHP
                     <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-$php = [
-    'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'],
-    'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'],
-    'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'],
-    'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'],
-];
+$sh = curl_share_init();
+curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
+curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
 
-$upcomingRelease = null;
-foreach ($php as $key => $version) {
-    if ($version['state'] === 'upcoming') {
-        $upcomingRelease = $version;
-        break;
-    }
-}
+$ch1 = curl_init('https://php.net/');
+curl_setopt($ch1, CURLOPT_SHARE, $sh);
 
-var_dump($upcomingRelease);
+curl_exec($ch1);
 PHP
-
                         ); ?>
                     </div>
                 </div>
                 <div class="php8-compare__arrow"></div>
-                <div class="php8-compare__block example-contents" 
style="display: table;">
+                <div class="php8-compare__block example-contents">
                     <div class="php8-compare__label 
php8-compare__label_new">PHP 8.5</div>
-                    <div class="php8-code phpcode" style="display: 
table-cell;">
+                    <div class="php8-code phpcode">
                         <?php highlight_php_trimmed(
                                 <<<'PHP'
-$php = [
-    'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'],
-    'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'],
-    'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'],
-    'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'],
-];
+$sh = curl_share_init_persistent([
+    CURL_LOCK_DATA_DNS,
+    CURL_LOCK_DATA_CONNECT
+]);
 
-$upcomingRelease = array_first(
-    array_filter(
-        $php,
-        static fn($version) => $version['state'] === 'upcoming'
-    )
-);
+$ch1 = curl_init('https://php.net/');
+curl_setopt($ch1, CURLOPT_SHARE, $sh);
 
-var_dump($upcomingRelease);
+// This may now reuse the connection from an earlier SAPI request
+curl_exec($ch1);
 PHP
                         ); ?>
                     </div>
                 </div>
             </div>
+            <div class="php8-compare__content">
+                <?= message('persistent_curl_share_handles_description', 
$lang) ?>
+            </div>
         </div>
     </section>
 
@@ -452,19 +410,18 @@ PHP
             <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>Property Promotion is now available for 
<code>final</code></li>
-                    <li>Attributes are now available for constants</li>
-                    <li>Attribute <a href="/manual/<?= $documentation 
?>/class.override.php"><code>#[\Override]</code></a> now works on 
properties</li>
-                    <li>Attribute <a href="/manual/<?= $documentation 
?>/class.deprecated.php"><code>#[\Deprecated]</code></a> available for 
traits</li>
-                    <li>Asymmetric Visibility for Static Properties</li>
-                    <li>New <code>#[\DelayedTargetValidation]</code> attribute 
is available</li>
-                    <li>New <a href="/manual/<?= $documentation 
?>/function.get-error-handler.php"><code>get_error_handler()</code></a>, <a 
href="/manual/<?= $documentation 
?>/function.get-exception-handler.php"><code>get_exception_handler()</code></a> 
functions are available.</li>
-                    <li>New <code>Closure::getCurrent</code> method is 
available.</li>
+                    <li>Fatal Errors (such as an exceeded maximum execution 
time) now include a backtrace.</li>
+                    <li>Attributes can now target constants.</li>
+                    <li><a href="/manual/<?= $documentation 
?>/class.override.php"><code>#[\Override]</code></a> attribute can now be 
applied to properties.</li>
+                    <li><a href="/manual/<?= $documentation 
?>/class.deprecated.php"><code>#[\Deprecated]</code></a> attribute can be used 
on traits and constants.</li>
+                    <li>Static properties now support asymmetric 
visibility.</li>
+                    <li>Properties can be marked as <code>final</code> using 
constructor property promotion.</li>
+                    <li>Added <code>Closure::getCurrent()</code> method to 
simplify recursion in anonymous functions.</li>
+                    <li><code>setcookie()</code> and 
<code>setrawcookie()</code> now support the "partitioned" key.</li>
+                    <li>New <a href="/manual/<?= $documentation 
?>/function.get-error-handler.php"><code>get_error_handler()</code></a> and <a 
href="/manual/<?= $documentation 
?>/function.get-exception-handler.php"><code>get_exception_handler()</code></a> 
functions are available.</li>
                     <li>New <code>Dom\Element::getElementsByClassName()</code> 
and <code>Dom\Element::insertAdjacentHTML()</code> methods are available.</li>
-                    <li>New <code>enchant_dict_remove_from_session()</code> 
and <code>enchant_dict_remove()</code> functions are available.</li>
-                    <li>New <code>grapheme_levenshtein()</code> function is 
available.</li>
-                    <li>New 
<code>opcache_is_script_cached_in_file_cache()</code> function is 
available.</li>
-                    <li>New <code>ReflectionConstant::getFileName()</code>, 
<code>ReflectionConstant::getExtension()</code>, 
<code>ReflectionConstant::getExtensionName()</code>, 
<code>ReflectionConstant::getAttributes()</code>, and 
<code>ReflectionProperty::getMangledName()</code> methods are available.</li>
+                    <li>Added <code>grapheme_levenshtein()</code> 
function.</li>
+                    <li>New <code>#[\DelayedTargetValidation]</code> attribute 
can be used to suppress compile-time errors from core and extension attributes 
that are used on invalid targets.</li>
                 </ul>
             </div>
         </div>
@@ -473,7 +430,16 @@ PHP
             <h2 class="php8-h2" id="deprecations_and_bc_breaks"><?= 
message('bc_title', $lang) ?></h2>
             <div class="php8-compare__content">
                 <ul>
-
+                    <li>The backtick operator as an alias for 
<code>shell_exec()</code> has been deprecated.</li>
+                    <li>Non-canonical cast names <code>(boolean)</code>, 
<code>(integer)</code>, <code>(double)</code>, and <code>(binary)</code> have 
been deprecated. Use <code>(bool)</code>, <code>(int)</code>, 
<code>(float)</code>, and <code>(string)</code> instead, respectively.</li>
+                    <li>The <code>disable_classes</code> INI setting has been 
removed as it causes various engine assumptions to be broken.</li>
+                    <li>Returning a non-string from a user output handler is 
deprecated.</li>
+                    <li>Terminating case statements with a semicolon instead 
of a colon has been deprecated.</li>
+                    <li>Using <code>null</code> as an array offset or when 
calling <code>array_key_exists()</code> is now deprecated. Use an empty string 
instead.</li>
+                    <li>It is no longer possible to use "array" and "callable" 
as class alias names in <code>class_alias()</code>.</li>
+                    <li>The <code>__sleep()</code> and <code>__wakeup()</code> 
magic methods have been soft-deprecated. The <code>__serialize()</code> and 
<code>__unserialize()</code> magic methods should be used instead.</li>
+                    <li>A warning is now emitted when casting <code>NAN</code> 
to other types.</li>
+                    <li>A warning is now emitted when casting floats (or 
strings that look like floats) to <code>int</code> if they cannot be 
represented as one.</li>
                 </ul>
             </div>
         </div>

Reply via email to