<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Marcolin&#039;s Blog</title>
    <link href="https://www.marcosmarcolin.com.br/en/blog" />
    <link type="application/atom+xml" rel="self" href="https://www.marcosmarcolin.com.br/en/feed.xml" />
    <updated>2026-11-20T00:00:00+00:00</updated>
    <id>https://www.marcosmarcolin.com.br/en/feed.xml</id>
    <author>
        <name>Marcos Marcolin</name>
    </author>
                <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-security-release-november-2026-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-security-release-november-2026-en" />
            <title>PHP fixes 7 critical flaws: what to do about 8.5.13 and 8.4.28</title>
            <published>2026-11-20T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">The 17 flaws fixed in PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36, including RCE in PHP-FPM and phpAfterShell: who is at risk and how to stay safe.</summary>
            <content type="html">&lt;p&gt;One month after &lt;a href=&quot;/en/blog/php2shell-critical-php-vulnerability-en&quot;&gt;PHP2Shell&lt;/a&gt;, PHP shipped another batch of security fixes. And this one is bigger: &lt;strong&gt;17 vulnerabilities, 7 of them critical&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;On November 19, &lt;strong&gt;PHP 8.5.13, 8.4.28, 8.3.37 and 8.2.36&lt;/strong&gt; came out, all of them security releases. &lt;a href=&quot;/en/blog/php-86-en&quot;&gt;PHP 8.6.0&lt;/a&gt; came out the same day and already ships with all of these fixes.&lt;/p&gt;

&lt;p&gt;If you don&#039;t have time to read the rest, take away just this: &lt;strong&gt;update to 8.5.13, 8.4.28, 8.3.37 or 8.2.36 (or to 8.6.0) and restart your workers.&lt;/strong&gt; And if you run PHP-FPM with persistent connections or the official Docker image, read the FPM part carefully.&lt;/p&gt;

&lt;h2&gt;Contents&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-came-out&quot;&gt;What came out on November 19&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#critical-flaws&quot;&gt;The critical flaws&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#high-and-medium-flaws&quot;&gt;The high and medium flaws&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#relation-to-php2shell&quot;&gt;How does this relate to PHP2Shell?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#am-i-vulnerable&quot;&gt;How do I know if I&#039;m vulnerable?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#cant-update-now&quot;&gt;I can&#039;t update right now, what now?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#unsupported-versions&quot;&gt;What about unsupported versions?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;what-came-out&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What came out on November 19&lt;/h2&gt;

&lt;p&gt;PHP announced a day in advance that the release would affect all supported versions and that the highest severity was &lt;strong&gt;critical&lt;/strong&gt;, but that the critical issues require non-default configuration or uncommon setups. That matters: unlike PHP2Shell, which hit practically any PHP serving HTTP, most of the current flaws depend on some specific condition.&lt;/p&gt;

&lt;p&gt;According to the advisories published on the php-src GitHub, there are &lt;strong&gt;7 critical, 4 high and 6 medium&lt;/strong&gt; flaws (CVSS v4.0), plus the update to the uriparser library bundled in &lt;code&gt;ext/uri&lt;/code&gt;, which the changelog lists as CVE-2026-48841. That&#039;s why some articles mention 18 flaws. Others mention 4 critical ones, but the official advisories rate 7 as critical.&lt;/p&gt;

&lt;p&gt;As of this writing, &lt;strong&gt;there are no reports of active exploitation&lt;/strong&gt; of these flaws, and none of them is in CISA&#039;s KEV catalog. Even so, there are already reports of public proofs of concept for some of them. And after PHP2Shell, I wouldn&#039;t count on that lasting long.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;critical-flaws&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The critical flaws&lt;/h2&gt;

&lt;p&gt;All the critical ones were rated &lt;strong&gt;CVSS v4.0 9.2&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-129289: request smuggling in PHP-FPM&lt;/h3&gt;

&lt;p&gt;This is the most serious one in the batch, and the one that deserves the most attention from anyone running FPM.&lt;/p&gt;

&lt;p&gt;When the application opens &lt;code&gt;php://input&lt;/code&gt; but doesn&#039;t read the request body to the end, PHP stops discarding what&#039;s left. With a malformed multipart body, the attacker&#039;s bytes are left on the connection. If the web server reuses the connection to FPM (&lt;code&gt;FCGI_KEEP_CONN&lt;/code&gt;), FPM parses those bytes as &lt;strong&gt;a new FastCGI request&lt;/strong&gt;, with forged parameters such as &lt;code&gt;SCRIPT_FILENAME&lt;/code&gt;, &lt;code&gt;REMOTE_ADDR&lt;/code&gt; and &lt;code&gt;PHP_ADMIN_VALUE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;From there, if the attacker knows the path of some PHP script that exists on the server, they just need to turn on &lt;code&gt;allow_url_include&lt;/code&gt; and point &lt;code&gt;auto_prepend_file&lt;/code&gt; at &lt;code&gt;php://input&lt;/code&gt; to run PHP code:&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Flow of CVE-2026-129289, from the malformed body to code execution in PHP-FPM&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 384&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;defs&gt;&lt;marker id=&quot;arr-fpm&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path class=&quot;arrow&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;10&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;35&quot; text-anchor=&quot;middle&quot;&gt;Attacker sends a malformed multipart body&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;50&quot; x2=&quot;240&quot; y2=&quot;70&quot; marker-end=&quot;url(#arr-fpm)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;72&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;97&quot; text-anchor=&quot;middle&quot;&gt;The app opens php://input and doesn&#039;t read it all&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;112&quot; x2=&quot;240&quot; y2=&quot;132&quot; marker-end=&quot;url(#arr-fpm)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;134&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;159&quot; text-anchor=&quot;middle&quot;&gt;The rest of the body stays on the reused connection&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;174&quot; x2=&quot;240&quot; y2=&quot;194&quot; marker-end=&quot;url(#arr-fpm)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;40&quot; y=&quot;196&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;221&quot; text-anchor=&quot;middle&quot;&gt;FPM parses those bytes as a new FastCGI request&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;236&quot; x2=&quot;240&quot; y2=&quot;256&quot; marker-end=&quot;url(#arr-fpm)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;40&quot; y=&quot;258&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;283&quot; text-anchor=&quot;middle&quot;&gt;Forged PHP_ADMIN_VALUE: allow_url_include, auto_prepend_file&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;298&quot; x2=&quot;240&quot; y2=&quot;318&quot; marker-end=&quot;url(#arr-fpm)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;40&quot; y=&quot;320&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;240&quot; y=&quot;345&quot; text-anchor=&quot;middle&quot;&gt;The attacker&#039;s code runs&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;240&quot; y=&quot;378&quot; text-anchor=&quot;middle&quot;&gt;Only happens if the web server reuses the connection to FPM&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;CVE-2026-129289: one request becomes two, and the second one belongs to the attacker.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;It&#039;s &lt;strong&gt;unauthenticated RCE in a single request&lt;/strong&gt;, with no memory corruption involved. And the changed settings can stick around on that worker.&lt;/p&gt;

&lt;p&gt;The good news: it only affects setups that reuse connections to FPM, such as &lt;code&gt;fastcgi_keep_conn on&lt;/code&gt; in Nginx, &lt;code&gt;enablereuse=on&lt;/code&gt; in Apache, or HAProxy with persistent connections. &lt;strong&gt;The default Nginx and Apache configurations are not affected.&lt;/strong&gt; The vulnerable code dates back to PHP 5.6. Details in advisory &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-qc49-hpvq-g2w6&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-qc49-hpvq-g2w6&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-115560: mismatched session serializers&lt;/h3&gt;

&lt;p&gt;This one was already announced on October 23, right after PHP2Shell, and now it&#039;s fixed. &lt;em&gt;Session upload progress&lt;/em&gt; writes progress data with one serializer (&lt;code&gt;php_binary&lt;/code&gt; or &lt;code&gt;php_serialize&lt;/code&gt;), and it can later be read with another (&lt;code&gt;php&lt;/code&gt;). A &lt;code&gt;|&lt;/code&gt; in the value sent as &lt;code&gt;PHP_SESSION_UPLOAD_PROGRESS&lt;/code&gt;, which PHP uses in the session key, becomes a delimiter and the content reaches &lt;code&gt;unserialize()&lt;/code&gt;. The result is object injection, which becomes RCE if the application has a &lt;em&gt;gadget chain&lt;/em&gt; available. The advisory mentions chains reproduced with Guzzle and Monolog.&lt;/p&gt;

&lt;p&gt;It requires upload progress to be enabled and the serializer to change at runtime or differ between applications, pools or CLI jobs sharing the same session store.&lt;/p&gt;

&lt;p&gt;The fix brings a &lt;strong&gt;behavior change&lt;/strong&gt;: &lt;code&gt;session.upload_progress.enabled&lt;/code&gt; is now &lt;strong&gt;disabled by default&lt;/strong&gt;, and changing session settings at runtime while it&#039;s enabled is now rejected. If you use an upload progress bar, you&#039;ll need to enable it explicitly. Advisory: &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-658j-r8rw-q6mx&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-658j-r8rw-q6mx&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-126714: phpAfterShell&lt;/h3&gt;

&lt;p&gt;This one was found by depthfirst &lt;strong&gt;while reviewing the PHP2Shell fix itself&lt;/strong&gt;, which is why it got the nickname &lt;em&gt;phpAfterShell&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;files&lt;/code&gt; session handler, PHP&#039;s default, didn&#039;t truncate the file before writing. An interrupted write left the start of the new session followed by the end of the old one, and that mix could deserialize attacker objects. The advisory says RCE depends on a gadget chain, but depthfirst claims it built the full chain using only PHP&#039;s native classes, without depending on the application. The remote path also goes through upload progress, so the same mitigation as the previous one applies here. Advisory: &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-fm2m-fjf5-v3cp&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-fm2m-fjf5-v3cp&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-129496: use after free in the timezone cache&lt;/h3&gt;

&lt;p&gt;In NTS builds, a startup warning written to a file-based &lt;code&gt;error_log&lt;/code&gt;, such as an invalid &lt;code&gt;date.timezone&lt;/code&gt;, leaves a dangling pointer. If a fresh worker emits another warning early in a request, such as the &lt;code&gt;max_input_vars&lt;/code&gt; one, it uses that pointer. Workers can be crashed remotely, and RCE was demonstrated locally, with known addresses and extra configuration. If your startup log has warnings, fix them anyway. Advisory: &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-gr4f-wgx5-jpfv&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-gr4f-wgx5-jpfv&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The other three critical flaws are direct consequences of PHP2Shell, and I cover them &lt;a href=&quot;#relation-to-php2shell&quot;&gt;further down&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;high-and-medium-flaws&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The high and medium flaws&lt;/h2&gt;

&lt;h3&gt;CVE-2026-129291: privilege escalation in PHP-FPM&lt;/h3&gt;

&lt;p&gt;Rated &lt;strong&gt;8.8&lt;/strong&gt;, but with a detail that catches a lot of people: with &lt;code&gt;catch_workers_output&lt;/code&gt; enabled, code running as the pool user can execute commands as the &lt;strong&gt;FPM master process, which usually runs as root&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The default for &lt;code&gt;catch_workers_output&lt;/code&gt; is &lt;code&gt;no&lt;/code&gt;, but &lt;strong&gt;the official PHP Docker images turn it on&lt;/strong&gt;, and the flaw was reproduced on them without any modification. It&#039;s a local attack, meaning the attacker already needs to run code in the pool. But combined with any other flaw in the application, it becomes the path to taking over the whole container. Advisory: &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-jm4m-qfqx-967m&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-jm4m-qfqx-967m&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-128064: uppercase &lt;code&gt;HTTPS://&lt;/code&gt; goes out unencrypted&lt;/h3&gt;

&lt;p&gt;This one is curious. PHP&#039;s HTTP and FTP stream wrappers didn&#039;t recognize the scheme when it was written in uppercase, so the request was sent &lt;strong&gt;in plain text&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;// Before the fix, this went out without TLS
$response = file_get_contents(&#039;HTTPS://api.example.com/orders?token=secret&#039;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It also applies to &lt;code&gt;FTPS://&lt;/code&gt; and to redirect targets, which means a server can redirect your request to a URL with an uppercase scheme and receive everything unencrypted. Tokens, passwords and the request body are exposed to anyone on the path. Rated &lt;strong&gt;8.2&lt;/strong&gt;. Advisory: &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-f6gg-rchx-xw8j&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-f6gg-rchx-xw8j&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;The rest&lt;/h3&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;CVE&lt;/th&gt;
  &lt;th&gt;Component&lt;/th&gt;
  &lt;th&gt;What it is&lt;/th&gt;
  &lt;th&gt;Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-127960&lt;/td&gt;
  &lt;td&gt;HTTP wrapper&lt;/td&gt;
  &lt;td&gt;&quot;Folded&quot; headers let a malicious server pin the CPU (DoS)&lt;/td&gt;
  &lt;td&gt;8.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-128090&lt;/td&gt;
  &lt;td&gt;Phar&lt;/td&gt;
  &lt;td&gt;Switching the signature algorithm bypasses the OpenSSL key&lt;/td&gt;
  &lt;td&gt;7.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-129538&lt;/td&gt;
  &lt;td&gt;php-cgi&lt;/td&gt;
  &lt;td&gt;Out-of-bounds read and write when fixing up &lt;code&gt;PATH_INFO&lt;/code&gt;&lt;/td&gt;
  &lt;td&gt;6.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-15353&lt;/td&gt;
  &lt;td&gt;SOAP&lt;/td&gt;
  &lt;td&gt;4-byte heap leak&lt;/td&gt;
  &lt;td&gt;6.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-129506&lt;/td&gt;
  &lt;td&gt;SOAP&lt;/td&gt;
  &lt;td&gt;Use after free in DTD entities (DoS)&lt;/td&gt;
  &lt;td&gt;6.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-129501&lt;/td&gt;
  &lt;td&gt;DOM&lt;/td&gt;
  &lt;td&gt;Double free in &lt;code&gt;saveXml()&lt;/code&gt; on &lt;code&gt;Dom\XMLDocument&lt;/code&gt; and &lt;code&gt;Dom\HTMLDocument&lt;/code&gt; (8.4 and 8.5)&lt;/td&gt;
  &lt;td&gt;6.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-129438&lt;/td&gt;
  &lt;td&gt;URI&lt;/td&gt;
  &lt;td&gt;Overflow when serializing ~2 GiB URIs (8.5 only)&lt;/td&gt;
  &lt;td&gt;6.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;CVE-2026-129292&lt;/td&gt;
  &lt;td&gt;PHP-FPM&lt;/td&gt;
  &lt;td&gt;XSS on the status page&lt;/td&gt;
  &lt;td&gt;5.3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The php-cgi one doesn&#039;t affect FPM or mod_php. The DOM one only affects the new API (&lt;code&gt;Dom\XMLDocument&lt;/code&gt; and &lt;code&gt;Dom\HTMLDocument&lt;/code&gt;), not the old &lt;code&gt;DOMDocument&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;relation-to-php2shell&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How does this relate to PHP2Shell?&lt;/h2&gt;

&lt;p&gt;Quite a lot. Of the 7 critical flaws, &lt;strong&gt;four came directly out of the October case&lt;/strong&gt;, and a fifth was announced alongside it:&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;The five critical November flaws linked to PHP2Shell&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 310&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;6&quot; y=&quot;125&quot; width=&quot;130&quot; height=&quot;60&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;71&quot; y=&quot;150&quot; text-anchor=&quot;middle&quot;&gt;PHP2Shell&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;71&quot; y=&quot;168&quot; text-anchor=&quot;middle&quot;&gt;October 2026&lt;/text&gt;
&lt;path class=&quot;line&quot; d=&quot;M136,155 L160,155 L160,33 L190,33&quot;/&gt;
&lt;path class=&quot;line&quot; d=&quot;M160,95 L190,95&quot;/&gt;
&lt;path class=&quot;line&quot; d=&quot;M160,155 L190,155&quot;/&gt;
&lt;path class=&quot;line&quot; d=&quot;M160,215 L190,215&quot;/&gt;
&lt;path class=&quot;line&quot; d=&quot;M160,155 L160,277 L190,277&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;190&quot; y=&quot;10&quot; width=&quot;284&quot; height=&quot;46&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;202&quot; y=&quot;30&quot;&gt;CVE-2026-129481 (8.3 to 8.5)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;202&quot; y=&quot;47&quot;&gt;Incomplete fix for CVE-2026-109619&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;190&quot; y=&quot;72&quot; width=&quot;284&quot; height=&quot;46&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;202&quot; y=&quot;92&quot;&gt;CVE-2026-129182 (8.5 only)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;202&quot; y=&quot;109&quot;&gt;Backtrace repopulated after shutdown&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;190&quot; y=&quot;132&quot; width=&quot;284&quot; height=&quot;46&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;202&quot; y=&quot;152&quot;&gt;CVE-2026-129474 (8.5 only)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;202&quot; y=&quot;169&quot;&gt;Reachable through the new OOM handling&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;190&quot; y=&quot;192&quot; width=&quot;284&quot; height=&quot;46&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;202&quot; y=&quot;212&quot;&gt;CVE-2026-126714 (phpAfterShell)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;202&quot; y=&quot;229&quot;&gt;Found while reviewing the PHP2Shell patch&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;190&quot; y=&quot;254&quot; width=&quot;284&quot; height=&quot;46&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;202&quot; y=&quot;274&quot;&gt;CVE-2026-115560&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;202&quot; y=&quot;291&quot;&gt;Announced alongside, but a separate flaw&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Five of the seven November critical flaws are linked to the October case.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The first three are memory bugs (use after free) in shutdown and backtraces. The two 8.5-only ones depend on &lt;code&gt;fatal_error_backtraces&lt;/code&gt;, which is the 8.5 default. CVE-2026-129474 also requires &lt;code&gt;zend.exception_ignore_args=0&lt;/code&gt;, and &lt;code&gt;php.ini-production&lt;/code&gt; already ships with &lt;code&gt;1&lt;/code&gt;, which blocks the attack. Details in advisories &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-g3vh-838c-65v7&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-g3vh-838c-65v7&lt;/a&gt;, &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-2fjv-p558-g82m&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-2fjv-p558-g82m&lt;/a&gt; and &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-8mjj-2r7p-4hg2&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-8mjj-2r7p-4hg2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That doesn&#039;t mean the October fix was poorly done. It&#039;s what usually happens after a big flaw: everyone, researchers and attackers alike, goes over the same code with a magnifying glass, often with help from AI. The PHP2Shell fix touched more than 300 files, so it was to be expected that some corners would still be uncovered.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;am-i-vulnerable&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How do I know if I&#039;m vulnerable?&lt;/h2&gt;

&lt;p&gt;You&#039;re protected if you&#039;re on one of these versions or later:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;Branch&lt;/th&gt;
  &lt;th&gt;Fixed version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;8.6&lt;/td&gt;
  &lt;td&gt;8.6.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.5&lt;/td&gt;
  &lt;td&gt;8.5.13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.4&lt;/td&gt;
  &lt;td&gt;8.4.28&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.3&lt;/td&gt;
  &lt;td&gt;8.3.37&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.2&lt;/td&gt;
  &lt;td&gt;8.2.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.1 or earlier&lt;/td&gt;
  &lt;td&gt;No fix from PHP&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Here&#039;s the same check from the PHP2Shell post, updated. Create a temporary file on the server, open it in the browser (so it runs under the same SAPI as the site) and &lt;strong&gt;delete it right after&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php
$fixed = [&#039;8.6&#039; =&amp;gt; &#039;8.6.0&#039;, &#039;8.5&#039; =&amp;gt; &#039;8.5.13&#039;, &#039;8.4&#039; =&amp;gt; &#039;8.4.28&#039;, &#039;8.3&#039; =&amp;gt; &#039;8.3.37&#039;, &#039;8.2&#039; =&amp;gt; &#039;8.2.36&#039;];
$branch = PHP_MAJOR_VERSION . &#039;.&#039; . PHP_MINOR_VERSION;

echo &#039;Version: &#039;, PHP_VERSION, &#039; | SAPI: &#039;, PHP_SAPI, PHP_EOL;

if (!isset($fixed[$branch])) {
    echo &#039;Unsupported branch: there is no official release with the fix&#039;, PHP_EOL;
} elseif (version_compare(PHP_VERSION, $fixed[$branch], &#039;&amp;lt;&#039;)) {
    echo &quot;VULNERABLE: update to {$fixed[$branch]} or later&quot;, PHP_EOL;
} else {
    echo &#039;Version includes the fix&#039;, PHP_EOL;
}

// Settings that increase exposure until you update
echo &#039;session.upload_progress.enabled: &#039;, ini_get(&#039;session.upload_progress.enabled&#039;) ?: &#039;0&#039;, PHP_EOL;
echo &#039;zend.exception_ignore_args: &#039;, ini_get(&#039;zend.exception_ignore_args&#039;) ?: &#039;0&#039;, PHP_EOL;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you use PHP-FPM, also check the web server and the pool:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;# Nginx: persistent connections to FPM (CVE-2026-129289)
grep -rn &quot;fastcgi_keep_conn&quot; /etc/nginx/

# FPM pool: catch_workers_output (CVE-2026-129291)
grep -rn &quot;catch_workers_output&quot; /usr/local/etc/php-fpm.d/ /etc/php/*/fpm/pool.d/ 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The same precautions from October still apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;distro packages&lt;/strong&gt; (Debian, Ubuntu, RHEL) backport fixes without changing the version number. Check your distribution&#039;s security advisory. Red Hat, for example, rated CVE-2026-129289 as critical;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Docker images don&#039;t update themselves&lt;/strong&gt;: run &lt;code&gt;docker pull&lt;/code&gt;, rebuild and deploy;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;restart all workers&lt;/strong&gt; after updating or changing any setting. Old processes keep running the old binary and the old &lt;code&gt;php.ini&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;cant-update-now&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;I can&#039;t update right now, what now?&lt;/h2&gt;

&lt;p&gt;These mitigations cover the most serious flaws. They &lt;strong&gt;reduce&lt;/strong&gt; the risk, but they don&#039;t replace updating.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;php.ini&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;session.upload_progress.enabled = 0   ; CVE-2026-115560 and CVE-2026-126714
zend.exception_ignore_args = 1        ; CVE-2026-129474 (PHP 8.5)
fatal_error_backtraces = 0            ; CVE-2026-129182 (PHP 8.5)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the FPM pool (&lt;code&gt;www.conf&lt;/code&gt; or equivalent):&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;catch_workers_output = no                               ; CVE-2026-129291
php_admin_flag[session.upload_progress.enabled] = off   ; if the pool overrides php.ini
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Set these options in &lt;code&gt;php.ini&lt;/code&gt; or with &lt;code&gt;php_admin_*&lt;/code&gt;, never with &lt;code&gt;ini_set()&lt;/code&gt; in the application: by then the request has already been processed and it&#039;s too late.&lt;/p&gt;

&lt;p&gt;On the web server, &lt;strong&gt;turn off connection reuse to FPM&lt;/strong&gt; (&lt;code&gt;fastcgi_keep_conn off&lt;/code&gt; in Nginx, no &lt;code&gt;enablereuse=on&lt;/code&gt; in Apache). That closes CVE-2026-129289, the most dangerous one on the list. For CVE-2026-129496, fix the startup warnings or send &lt;code&gt;error_log&lt;/code&gt; to syslog.&lt;/p&gt;

&lt;p&gt;After changing any of these options, &lt;strong&gt;restart all workers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;unsupported-versions&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What about unsupported versions?&lt;/h2&gt;

&lt;p&gt;In October, PHP itself published backport branches for 7.4, 8.0 and 8.1. &lt;strong&gt;This time, PHP published nothing for unsupported versions.&lt;/strong&gt; And the advisories list PHP 8.1 as affected with no fix for at least two flaws: the FPM privilege escalation and the HTTP wrapper DoS. Since several of the flaws have existed since PHP 4 or 5, older versions are very likely affected by almost all of them.&lt;/p&gt;

&lt;p&gt;The good news comes, once again, from &lt;strong&gt;Ondřej Surý&lt;/strong&gt;, who maintains the &lt;code&gt;ppa:ondrej/php&lt;/code&gt; and &lt;code&gt;deb.sury.org&lt;/code&gt; packages. He has already backported the fixes to PHP 5.6 through 8.1 as new package revisions. The version number doesn&#039;t change (&lt;code&gt;php -v&lt;/code&gt; still shows 8.1.34, for example), so what matters is the package revision:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;Version&lt;/th&gt;
  &lt;th&gt;Fixed revision (or later)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;8.1&lt;/td&gt;
  &lt;td&gt;&lt;code&gt;8.1.34-13&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.0&lt;/td&gt;
  &lt;td&gt;&lt;code&gt;1:8.0.30-30&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;7.4&lt;/td&gt;
  &lt;td&gt;&lt;code&gt;1:7.4.33-36&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;5.6 to 7.3&lt;/td&gt;
  &lt;td&gt;Also got new revisions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;To check:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;apt update &amp;amp;&amp;amp; apt upgrade
dpkg -l &#039;php8.1*&#039; | awk &#039;/^ii/ {print $2, $3}&#039;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you use a mirror of the PPA, the packages may take a few hours to arrive. Ubuntu Pro has also published fixes for the old packages, from PHP 5 to 7.4, but not yet for every CVE.&lt;/p&gt;

&lt;p&gt;That solves the immediate problem, but it&#039;s still a stopgap: it depends on one person&#039;s volunteer work and doesn&#039;t replace being on a supported version.&lt;/p&gt;

&lt;p&gt;And a reminder: &lt;strong&gt;PHP 8.2 reaches end of life on December 31, 2026&lt;/strong&gt;, a little over a month from now. The next batch of fixes affecting 8.2 in 2027 won&#039;t get a release. If you&#039;re still on it, now is the time to plan the migration. And &lt;a href=&quot;/en/blog/php-86-en&quot;&gt;PHP 8.6&lt;/a&gt; just came out with plenty of good stuff.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;conclusion&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;This release didn&#039;t make as much noise as PHP2Shell, but it has flaws just as serious, only more dependent on configuration. The FPM one with persistent connections is what I&#039;d look at first, followed by the privilege escalation in the official Docker images.&lt;/p&gt;

&lt;p&gt;The pace also stands out: two big batches of critical CVEs in one month. That has a lot to do with the current moment, in which AI has sped up the discovery of old flaws across the whole ecosystem, not just in PHP. The good side is that PHP is responding within its regular release cycle, with detailed advisories and clear mitigations.&lt;/p&gt;

&lt;p&gt;The lesson is the same as in October: &lt;strong&gt;update&lt;/strong&gt;, restart your workers and keep your environment in a state where updating is routine, not an emergency.&lt;/p&gt;

&lt;p&gt;Until next time, cheers! 🐘&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/archive/2026.php&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP.net: release announcements for 8.5.13, 8.4.28, 8.3.37, 8.2.36 and 8.6.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/ChangeLog-8.php&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP.net: PHP 8 ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/php/php-src/security/advisories&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GitHub: php-src security advisories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/supported-versions.php&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP.net: supported versions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.precursorsecurity.com/blog/phpaftershell-critical-php-rce-vulnerabilities&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Precursor Security: phpAfterShell, critical PHP RCE vulnerabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.techzine.eu/news/security/145948/php-security-updates-fix-18-vulnerabilities/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Techzine: PHP security updates fix 18 vulnerabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.chainguard.dev/unchained/phps-november-security-release-what-it-is-and-what-to-update&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Chainguard: PHP&#039;s November security release, what it is and what to update&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2026-129289.json&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Red Hat: CVE-2026-129289&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/socket-io-v4-php-server-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/socket-io-v4-php-server-en" />
            <title>Socket.IO v4 in PHP: a new server benchmarked against Node.js</title>
            <published>2026-11-16T00:00:00+00:00</published>
            <updated>2026-11-17T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">A Socket.IO v4 server in PHP that works with socket.io-client v3 and v4: features, migrating from phpsocket.io and a benchmark against Node.js with the JIT.</summary>
            <content type="html">&lt;p&gt;Since 2021 I&#039;ve been using &lt;a href=&quot;https://github.com/walkor/phpsocket.io&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;phpsocket.io&lt;/a&gt; in production. It came in to replace a legacy Node.js server. I started as a user, began contributing to the project and, over time, was invited to become one of its maintainers. It&#039;s the most used Socket.IO package in the PHP ecosystem, but it has a limitation that matters more every year: it only speaks the old protocol, so it only works with &lt;code&gt;socket.io-client&lt;/code&gt; 1.x and 2.x. It also stays on Workerman 4, because Workerman 5 requires PHP 8.1 and the package still serves people on PHP 7.4.&lt;/p&gt;

&lt;p&gt;To solve that, I built &lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;socket.io-server&lt;/a&gt;, a Socket.IO v4 server for PHP, built on &lt;a href=&quot;https://github.com/walkor/workerman&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Workerman&lt;/a&gt;, a PHP framework for asynchronous network servers that runs as its own process, outside PHP-FPM. It works with the official &lt;code&gt;socket.io-client&lt;/code&gt; v3 and v4, follows an API close to phpsocket.io&#039;s and, with OPcache and the JIT on, gets close to the official Node.js server while using less memory.&lt;/p&gt;

&lt;p&gt;The package is at version 0.x and ready to use. If you need Socket.IO v4 in PHP, or want to move off the 2.x client, give it a try and let me know how it goes: feedback, issues and pull requests are very welcome.&lt;/p&gt;

&lt;h2&gt;Table of contents&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#socketio-vs-websocket&quot;&gt;Socket.IO vs WebSocket: what&#039;s the difference?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-problem&quot;&gt;Why phpsocket.io doesn&#039;t work with socket.io-client v3 and v4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-a-new-package&quot;&gt;Why a new package&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-it-does&quot;&gt;What it does&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#performance&quot;&gt;Performance against the official server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#soak-test&quot;&gt;Continuous load test without leaking memory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#building-with-ai&quot;&gt;Building it with AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#next-steps&quot;&gt;Current state and next steps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#faq&quot;&gt;FAQ&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;socketio-vs-websocket&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Socket.IO vs WebSocket: what&#039;s the difference?&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;WebSocket&lt;/strong&gt; is a standard web protocol that keeps a connection open between client and server, so both can send messages at any time, without the client having to keep asking. But that&#039;s all it gives you: loose messages, text or binary. Reconnecting, knowing which answer belongs to which question, sending to a group of users, it&#039;s all up to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Socket.IO&lt;/strong&gt; was born in 2010 as a library for Node.js, and the official server is still in Node. Its protocol is documented, which makes it possible to implement servers and clients in other languages, such as Java, Python and Rust.&lt;/p&gt;

&lt;p&gt;It isn&#039;t an alternative to WebSocket: it uses WebSocket as a transport and adds what&#039;s missing on top. That means named events (&lt;code&gt;emit&lt;/code&gt; and &lt;code&gt;on&lt;/code&gt;), answers through callbacks (acknowledgements), rooms to send messages to groups, automatic reconnection and a fallback to HTTP long-polling (HTTP requests that stay open until there&#039;s something to answer) when a proxy or firewall blocks WebSocket. Since it has its own protocol, a Socket.IO client can&#039;t talk to a plain WebSocket server, or the other way around: the server has to speak Socket.IO too, and the right version of it.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;How Socket.IO works: client A connects over HTTP, upgrades to WebSocket, sends an event, the server relays it to the clients in the room and answers with an ack&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 322&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;defs&gt;&lt;marker id=&quot;arr-flow&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;&lt;path class=&quot;arrow&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;box&quot; x=&quot;10&quot; y=&quot;10&quot; width=&quot;120&quot; height=&quot;34&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;70&quot; y=&quot;32&quot; text-anchor=&quot;middle&quot;&gt;Client A&lt;/text&gt;
&lt;line class=&quot;grid&quot; style=&quot;stroke-dasharray:4 3&quot; x1=&quot;70&quot; y1=&quot;44&quot; x2=&quot;70&quot; y2=&quot;288&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;180&quot; y=&quot;10&quot; width=&quot;120&quot; height=&quot;34&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;240&quot; y=&quot;32&quot; text-anchor=&quot;middle&quot;&gt;Server&lt;/text&gt;
&lt;line class=&quot;grid&quot; style=&quot;stroke-dasharray:4 3&quot; x1=&quot;240&quot; y1=&quot;44&quot; x2=&quot;240&quot; y2=&quot;288&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;350&quot; y=&quot;10&quot; width=&quot;120&quot; height=&quot;34&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;410&quot; y=&quot;32&quot; text-anchor=&quot;middle&quot;&gt;Client B&lt;/text&gt;
&lt;line class=&quot;grid&quot; style=&quot;stroke-dasharray:4 3&quot; x1=&quot;410&quot; y1=&quot;44&quot; x2=&quot;410&quot; y2=&quot;288&quot;/&gt;
&lt;line class=&quot;line&quot; x1=&quot;74&quot; y1=&quot;86&quot; x2=&quot;236&quot; y2=&quot;86&quot; marker-end=&quot;url(#arr-flow)&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;155&quot; y=&quot;78&quot; text-anchor=&quot;middle&quot;&gt;1. handshake over HTTP&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;74&quot; y1=&quot;130&quot; x2=&quot;236&quot; y2=&quot;130&quot; marker-start=&quot;url(#arr-flow)&quot; marker-end=&quot;url(#arr-flow)&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;155&quot; y=&quot;122&quot; text-anchor=&quot;middle&quot;&gt;2. upgrade to WebSocket&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;74&quot; y1=&quot;174&quot; x2=&quot;236&quot; y2=&quot;174&quot; marker-end=&quot;url(#arr-flow)&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;155&quot; y=&quot;166&quot; text-anchor=&quot;middle&quot;&gt;3. emit(&#039;chat&#039;, &#039;hi&#039;)&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;244&quot; y1=&quot;218&quot; x2=&quot;406&quot; y2=&quot;218&quot; marker-end=&quot;url(#arr-flow)&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;325&quot; y=&quot;210&quot; text-anchor=&quot;middle&quot;&gt;4. relays to room lobby&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;236&quot; y1=&quot;262&quot; x2=&quot;74&quot; y2=&quot;262&quot; marker-end=&quot;url(#arr-flow)&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;155&quot; y=&quot;254&quot; text-anchor=&quot;middle&quot;&gt;5. ack(&#039;delivered&#039;)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;240&quot; y=&quot;310&quot; text-anchor=&quot;middle&quot;&gt;If the connection drops, the client reconnects on its own and gets what it missed.&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;How Socket.IO works: client B is already in the lobby room, and client A sends it a message.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;a id=&quot;the-problem&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Why phpsocket.io doesn&#039;t work with socket.io-client v3 and v4&lt;/h2&gt;

&lt;p&gt;Socket.IO has two layers. At the bottom is &lt;strong&gt;Engine.IO&lt;/strong&gt;, which handles the connection: it opens over HTTP long-polling, upgrades to WebSocket when it can and keeps the heartbeat going. On top is &lt;strong&gt;Socket.IO&lt;/strong&gt;, with events, namespaces, rooms and acknowledgements.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Socket.IO layers on the client and the server: application, Socket.IO, Engine.IO and transport, with client and server speaking the same version of each protocol&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 284&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;defs&gt;&lt;marker id=&quot;arr-layers&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;&lt;path class=&quot;arrow&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;text class=&quot;t-b&quot; x=&quot;91&quot; y=&quot;24&quot; text-anchor=&quot;middle&quot;&gt;Browser&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;351&quot; y=&quot;24&quot; text-anchor=&quot;middle&quot;&gt;PHP server&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;6&quot; y=&quot;40&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;91&quot; y=&quot;69&quot; text-anchor=&quot;middle&quot;&gt;Your JavaScript code&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;266&quot; y=&quot;40&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;351&quot; y=&quot;69&quot; text-anchor=&quot;middle&quot;&gt;Your PHP code&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;6&quot; y=&quot;102&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;91&quot; y=&quot;122&quot; text-anchor=&quot;middle&quot;&gt;Socket.IO&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;91&quot; y=&quot;139&quot; text-anchor=&quot;middle&quot;&gt;socket.io-client&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;266&quot; y=&quot;102&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;351&quot; y=&quot;122&quot; text-anchor=&quot;middle&quot;&gt;Socket.IO&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;351&quot; y=&quot;139&quot; text-anchor=&quot;middle&quot;&gt;events, rooms, acks&lt;/text&gt;
&lt;line class=&quot;crit-line&quot; style=&quot;stroke:var(--viz-muted)&quot; x1=&quot;176&quot; y1=&quot;126&quot; x2=&quot;266&quot; y2=&quot;126&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;221&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;protocol v5&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;6&quot; y=&quot;164&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;91&quot; y=&quot;184&quot; text-anchor=&quot;middle&quot;&gt;Engine.IO&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;91&quot; y=&quot;201&quot; text-anchor=&quot;middle&quot;&gt;inside the client&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;266&quot; y=&quot;164&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;351&quot; y=&quot;184&quot; text-anchor=&quot;middle&quot;&gt;Engine.IO&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;351&quot; y=&quot;201&quot; text-anchor=&quot;middle&quot;&gt;handshake, heartbeat, upgrade&lt;/text&gt;
&lt;line class=&quot;crit-line&quot; style=&quot;stroke:var(--viz-muted)&quot; x1=&quot;176&quot; y1=&quot;188&quot; x2=&quot;266&quot; y2=&quot;188&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;221&quot; y=&quot;182&quot; text-anchor=&quot;middle&quot;&gt;protocol v4&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;6&quot; y=&quot;226&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;91&quot; y=&quot;246&quot; text-anchor=&quot;middle&quot;&gt;Transport&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;91&quot; y=&quot;263&quot; text-anchor=&quot;middle&quot;&gt;WebSocket or HTTP&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;266&quot; y=&quot;226&quot; width=&quot;170&quot; height=&quot;48&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;351&quot; y=&quot;246&quot; text-anchor=&quot;middle&quot;&gt;Workerman&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;351&quot; y=&quot;263&quot; text-anchor=&quot;middle&quot;&gt;TCP, HTTP and WebSocket&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;180&quot; y1=&quot;250&quot; x2=&quot;262&quot; y2=&quot;250&quot; marker-start=&quot;url(#arr-layers)&quot; marker-end=&quot;url(#arr-layers)&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;221&quot; y=&quot;242&quot; text-anchor=&quot;middle&quot;&gt;network&lt;/text&gt;
&lt;path class=&quot;line&quot; d=&quot;M438,100 H442 V214 H438&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;446&quot; y=&quot;157&quot; text-anchor=&quot;middle&quot; transform=&quot;rotate(90 446 157)&quot;&gt;socket.io-server&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;The layers of Socket.IO. Client and server must speak the same version of each protocol.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;In Socket.IO 3.0, released in 2020, both layers changed protocol: Engine.IO went to v4 and Socket.IO to v5. And the change is incompatible both ways. By default, a 2.x client can&#039;t connect to a v4 server (the official Node server has the &lt;code&gt;allowEIO3&lt;/code&gt; option to accept old clients during a migration), and a v3 or v4 client can&#039;t connect to an old server.&lt;/p&gt;

&lt;p&gt;phpsocket.io implements the old protocol (Engine.IO v3). In practice, anyone using PHP on the server is stuck with the 2.x line of the JavaScript client, which stopped getting new features in 2020 (its last version, 2.5.0, is from 2022), without what came after, such as connection state recovery.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;why-a-new-package&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Why a new package&lt;/h2&gt;

&lt;p&gt;Today there&#039;s no PHP server for Socket.IO v4 on the site&#039;s &lt;a href=&quot;https://socket.io/docs/v4/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;official list of implementations&lt;/a&gt;. The other known package, &lt;a href=&quot;https://github.com/hyperf/socketio-server&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;hyperf/socketio-server&lt;/a&gt;, only implements the WebSocket transport and documents the 2.x client.&lt;/p&gt;

&lt;p&gt;The first idea would be to update phpsocket.io itself. The problem is the incompatibility: switching the protocol would break everyone using the package today, because the old clients would stop connecting. Migrating means changing the client and the server together, and that has to be each project&#039;s decision, not a &lt;code&gt;composer update&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There&#039;s also the PHP version. phpsocket.io runs on Workerman 4 and accepts PHP 7.4, and the people using it today may be on older versions. Workerman 5, the current version, requires PHP 8.1, so moving phpsocket.io to it would force everyone to upgrade PHP along with it. A new package could start from a current base without breaking anyone: PHP 8.1 or later, Workerman 5, types everywhere and PHPStan at the maximum level. phpsocket.io keeps serving the 1.x and 2.x clients, and socket.io-server the v3 and v4 ones.&lt;/p&gt;

&lt;p&gt;To make migrating easier, the server&#039;s API follows phpsocket.io&#039;s shape, and the repository has a &lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/blob/main/docs/migrating-from-phpsocket.io.md&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;migration guide&lt;/a&gt; covering what changes in the code and on the client.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/walkor/phpsocket.io#readme&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;phpsocket.io&#039;s README&lt;/a&gt; already points to socket.io-server for anyone who needs the v3 and v4 clients.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;what-it-does&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What it does&lt;/h2&gt;

&lt;p&gt;A complete server fits in a few lines:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

use Marcolin\SocketIO\Socket;
use Marcolin\SocketIO\SocketIO;
use Workerman\Worker;

require __DIR__ . &#039;/vendor/autoload.php&#039;;

$io = new SocketIO(3000, [&#039;cors&#039; =&amp;gt; [&#039;origin&#039; =&amp;gt; [&#039;https://example.com&#039;]]]);

$io-&amp;gt;on(&#039;connection&#039;, function (Socket $socket) use ($io): void {
    $socket-&amp;gt;join(&#039;lobby&#039;);
    $socket-&amp;gt;emit(&#039;hello&#039;, &#039;world&#039;);

    $socket-&amp;gt;on(&#039;chat&#039;, function (string $message, ?Closure $ack = null) use ($io): void {
        $io-&amp;gt;to(&#039;lobby&#039;)-&amp;gt;emit(&#039;chat&#039;, $message);
        if ($ack !== null) {
            $ack(&#039;delivered&#039;);
        }
    });
});

Worker::runAll();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And on the client, the official &lt;code&gt;socket.io-client&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;import { io } from &quot;socket.io-client&quot;;

const socket = io(&quot;http://localhost:3000&quot;);

socket.on(&quot;hello&quot;, (word) =&amp;gt; console.log(word));
socket.emit(&quot;chat&quot;, &quot;hi&quot;, (status) =&amp;gt; console.log(status)); // &quot;delivered&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What&#039;s already implemented:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Transports:&lt;/strong&gt; HTTP long-polling and WebSocket on the same port, with the upgrade from one to the other (no WebTransport yet);&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Protocol features:&lt;/strong&gt; namespaces (separate channels on the same server, such as &lt;code&gt;/chat&lt;/code&gt; and &lt;code&gt;/admin&lt;/code&gt;), middlewares, rooms, acknowledgements (broadcasts too, with a timeout), binary data and catch-all listeners (which receive any event);&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Connection state recovery:&lt;/strong&gt; a client that lost its connection comes back with the same socket, the same rooms and the events it missed;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Several processes and machines:&lt;/strong&gt; an event sent in one process reaches the clients connected to the others, through &lt;a href=&quot;https://github.com/walkor/channel&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;workerman/channel&lt;/a&gt; (Workerman&#039;s own message server), Redis pub/sub or Redis Streams;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The rest:&lt;/strong&gt; CORS with cookies, TLS, compression, a debug log and the official Admin UI (a web panel to watch sockets, rooms and events live).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where it makes the most sense: when the team and the application are PHP. With the &lt;code&gt;Emitter&lt;/code&gt;, a regular PHP-FPM request sends events to the connected clients, through Redis, without running a Node.js service just for that. If the application is already Node, the official server is still the natural choice.&lt;/p&gt;

&lt;p&gt;To know whether the server speaks the protocol correctly, it runs the official compliance suites for &lt;a href=&quot;https://github.com/socketio/socket.io/tree/main/docs/engine.io-protocol/v4-test-suite&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Engine.IO&lt;/a&gt; (25 of 25 tests) and &lt;a href=&quot;https://github.com/socketio/socket.io/tree/main/docs/socket.io-protocol/v5-test-suite&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Socket.IO&lt;/a&gt; (32 of 32) on every pull request, plus integration tests with the official client, on PHP 8.1 to 8.5.&lt;/p&gt;

&lt;h3&gt;What you can build&lt;/h3&gt;

&lt;p&gt;The repository&#039;s examples show how the package works, not the limit of what you can do with it. Some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chat and private messages, with a typing indicator and messages that reach users who dropped and came back (&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/chat&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;chat&lt;/a&gt;, &lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/private-messaging&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;private-messaging&lt;/a&gt;);&lt;/li&gt;
&lt;li&gt;Notifications triggered by the PHP application itself (&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/emitter&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;emitter&lt;/a&gt;);&lt;/li&gt;
&lt;li&gt;Live dashboards, with the server pushing new numbers to whoever is watching each one (&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/dashboard&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;dashboard&lt;/a&gt;);&lt;/li&gt;
&lt;li&gt;Multiplayer games: a Pong with a match queue and a space arena with bots, with the game loop running on the server at 30 frames per second (&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/pong&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;pong&lt;/a&gt;, &lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/tree/main/examples/arena&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;arena&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are 14 examples in all, and each one runs with a single command. Beyond them, the package fits anything that needs real-time updates, such as order and delivery tracking, auctions, support queues, collaborative editing and monitoring alerts.&lt;/p&gt;

&lt;h3&gt;In production&lt;/h3&gt;

&lt;p&gt;The server is a long-lived PHP process, so in production it has to stay up at all times and come back on its own if it dies. For that I use &lt;a href=&quot;http://supervisord.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Supervisor&lt;/a&gt;, running the server in the foreground (&lt;code&gt;start&lt;/code&gt;, without &lt;code&gt;-d&lt;/code&gt;) and letting it take control:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;[program:socketio]
command=php -d memory_limit=512M /var/www/app/server.php start
directory=/var/www/app
user=www-data
autostart=true
autorestart=true
stopsignal=INT
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=/var/log/socketio.log
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With that, &lt;code&gt;supervisorctl start socketio&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt;, &lt;code&gt;restart&lt;/code&gt; and &lt;code&gt;status&lt;/code&gt; control the process, it starts with the machine and restarts if it dies. Two things to watch: the open files limit has to be higher than the number of connections (in Supervisor, &lt;code&gt;minfds&lt;/code&gt; in the &lt;code&gt;[supervisord]&lt;/code&gt; section), and the OPcache and JIT settings from the performance section apply here too.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;performance&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Performance against the official server&lt;/h2&gt;

&lt;p&gt;I ran the same load test on socket.io-server and on the official server (&lt;code&gt;socket.io&lt;/code&gt; 4.8.4 on Node.js 24): one process each, the same handlers and the same machine (a MacBook Pro M4 Pro, all in Docker), with the official &lt;code&gt;socket.io-client&lt;/code&gt; over WebSocket and the &lt;code&gt;event&lt;/code&gt; extension on PHP, which gives Workerman an event loop that handles thousands of connections (without it, it uses &lt;code&gt;select()&lt;/code&gt;, limited to about a thousand). Each number is the median of three runs, all in the same session.&lt;/p&gt;

&lt;p&gt;It&#039;s a simple benchmark, with a margin of error: the numbers vary by up to 10% between sessions, and up to 15% within one session at 1,000 clients. The server and the clients run together on a single machine, so the numbers are meant to compare the servers with each other, not as the capacity of a production server. Measuring a system in production is hard: the network, the hardware, the size of the messages and the application&#039;s own code all change the result. These tests are an estimate, not a promise.&lt;/p&gt;

&lt;p&gt;Each measurement has three parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Memory:&lt;/strong&gt; the process&#039;s total RSS with every client connected;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Acknowledgements:&lt;/strong&gt; each client sends 20 messages in sequence, waiting for each answer, all clients at once;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Broadcasts:&lt;/strong&gt; 50 events of 100 bytes to every client at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the PHP side, I measured two setups: PHP 8.1 out of the box, and PHP 8.5 with OPcache and the JIT on. I explain why right after the charts.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Total process memory (RSS) at 1,000, 5,000 and 10,000 clients: PHP 8.1, PHP 8.5 with the JIT and the official Node.js server&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 268&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;s1&quot; x=&quot;56&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;74&quot; y=&quot;21&quot;&gt;PHP 8.1&lt;/text&gt;
&lt;rect class=&quot;s3&quot; x=&quot;172&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;190&quot; y=&quot;21&quot;&gt;PHP 8.5 with JIT&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;318&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;336&quot; y=&quot;21&quot;&gt;Node.js&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;240.0&quot; x2=&quot;470&quot; y2=&quot;240.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;244.0&quot; text-anchor=&quot;end&quot;&gt;0&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;180.0&quot; x2=&quot;470&quot; y2=&quot;180.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;184.0&quot; text-anchor=&quot;end&quot;&gt;100&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;120.0&quot; x2=&quot;470&quot; y2=&quot;120.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;124.0&quot; text-anchor=&quot;end&quot;&gt;200&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;60.0&quot; x2=&quot;470&quot; y2=&quot;60.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;64.0&quot; text-anchor=&quot;end&quot;&gt;300&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;46&quot; text-anchor=&quot;end&quot;&gt;MB&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M69.0,240 V220.0 Q69.0,216.0 73.0,216.0 H101.0 Q105.0,216.0 105.0,220.0 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 1,000 clients: 40 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;87.0&quot; y=&quot;210.0&quot; text-anchor=&quot;middle&quot;&gt;40&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M107.0,240 V214.6 Q107.0,210.6 111.0,210.6 H139.0 Q143.0,210.6 143.0,214.6 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 1,000 clients: 49 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125.0&quot; y=&quot;204.6&quot; text-anchor=&quot;middle&quot;&gt;49&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M145.0,240 V185.2 Q145.0,181.2 149.0,181.2 H177.0 Q181.0,181.2 181.0,185.2 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 1,000 clients: 98 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;163.0&quot; y=&quot;175.2&quot; text-anchor=&quot;middle&quot;&gt;98&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;1,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M207.0,240 V160.0 Q207.0,156.0 211.0,156.0 H239.0 Q243.0,156.0 243.0,160.0 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 5,000 clients: 140 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;225.0&quot; y=&quot;150.0&quot; text-anchor=&quot;middle&quot;&gt;140&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M245.0,240 V157.6 Q245.0,153.6 249.0,153.6 H277.0 Q281.0,153.6 281.0,157.6 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 5,000 clients: 144 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;263.0&quot; y=&quot;147.6&quot; text-anchor=&quot;middle&quot;&gt;144&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M283.0,240 V119.8 Q283.0,115.8 287.0,115.8 H315.0 Q319.0,115.8 319.0,119.8 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 5,000 clients: 207 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;301.0&quot; y=&quot;109.8&quot; text-anchor=&quot;middle&quot;&gt;207&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;263.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;5,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M345.0,240 V86.8 Q345.0,82.8 349.0,82.8 H377.0 Q381.0,82.8 381.0,86.8 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 10,000 clients: 262 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;363.0&quot; y=&quot;76.8&quot; text-anchor=&quot;middle&quot;&gt;262&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M383.0,240 V86.8 Q383.0,82.8 387.0,82.8 H415.0 Q419.0,82.8 419.0,86.8 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 10,000 clients: 262 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;401.0&quot; y=&quot;76.8&quot; text-anchor=&quot;middle&quot;&gt;262&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M421.0,240 V78.4 Q421.0,74.4 425.0,74.4 H453.0 Q457.0,74.4 457.0,78.4 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 10,000 clients: 276 MB&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;439.0&quot; y=&quot;68.4&quot; text-anchor=&quot;middle&quot;&gt;276&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;401.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;10,000 clients&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Total process memory (RSS), in MB. Lower is better.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;On memory, PHP stays below at every size. The biggest gap is at the start: the PHP process begins at about 13 MB, Node at 64 MB. At 10,000 clients the gap shrinks to 5%. Each connection costs about 25 KB, and growth is linear. The JIT costs 8 to 13 MB, once, not per connection.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Acknowledgements per second at 1,000, 5,000 and 10,000 clients: PHP 8.1, PHP 8.5 with the JIT and Node.js&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 268&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;s1&quot; x=&quot;56&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;74&quot; y=&quot;21&quot;&gt;PHP 8.1&lt;/text&gt;
&lt;rect class=&quot;s3&quot; x=&quot;172&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;190&quot; y=&quot;21&quot;&gt;PHP 8.5 with JIT&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;318&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;336&quot; y=&quot;21&quot;&gt;Node.js&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;240.0&quot; x2=&quot;470&quot; y2=&quot;240.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;244.0&quot; text-anchor=&quot;end&quot;&gt;0&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;195.0&quot; x2=&quot;470&quot; y2=&quot;195.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;199.0&quot; text-anchor=&quot;end&quot;&gt;25&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;150.0&quot; x2=&quot;470&quot; y2=&quot;150.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;154.0&quot; text-anchor=&quot;end&quot;&gt;50&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;105.0&quot; x2=&quot;470&quot; y2=&quot;105.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;109.0&quot; text-anchor=&quot;end&quot;&gt;75&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;60.0&quot; x2=&quot;470&quot; y2=&quot;60.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;64.0&quot; text-anchor=&quot;end&quot;&gt;100&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;46&quot; text-anchor=&quot;end&quot;&gt;k/s&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M69.0,240 V128.8 Q69.0,124.8 73.0,124.8 H101.0 Q105.0,124.8 105.0,128.8 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 1,000 clients: 64k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;87.0&quot; y=&quot;118.8&quot; text-anchor=&quot;middle&quot;&gt;64&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M107.0,240 V132.4 Q107.0,128.4 111.0,128.4 H139.0 Q143.0,128.4 143.0,132.4 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 1,000 clients: 62k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125.0&quot; y=&quot;122.4&quot; text-anchor=&quot;middle&quot;&gt;62&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M145.0,240 V123.4 Q145.0,119.4 149.0,119.4 H177.0 Q181.0,119.4 181.0,123.4 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 1,000 clients: 67k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;163.0&quot; y=&quot;113.4&quot; text-anchor=&quot;middle&quot;&gt;67&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;1,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M207.0,240 V103.6 Q207.0,99.6 211.0,99.6 H239.0 Q243.0,99.6 243.0,103.6 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 5,000 clients: 78k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;225.0&quot; y=&quot;93.6&quot; text-anchor=&quot;middle&quot;&gt;78&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M245.0,240 V71.2 Q245.0,67.2 249.0,67.2 H277.0 Q281.0,67.2 281.0,71.2 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 5,000 clients: 96k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;263.0&quot; y=&quot;61.2&quot; text-anchor=&quot;middle&quot;&gt;96&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M283.0,240 V73.0 Q283.0,69.0 287.0,69.0 H315.0 Q319.0,69.0 319.0,73.0 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 5,000 clients: 95k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;301.0&quot; y=&quot;63.0&quot; text-anchor=&quot;middle&quot;&gt;95&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;263.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;5,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M345.0,240 V114.4 Q345.0,110.4 349.0,110.4 H377.0 Q381.0,110.4 381.0,114.4 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 10,000 clients: 72k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;363.0&quot; y=&quot;104.4&quot; text-anchor=&quot;middle&quot;&gt;72&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M383.0,240 V87.4 Q383.0,83.4 387.0,83.4 H415.0 Q419.0,83.4 419.0,87.4 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 10,000 clients: 87k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;401.0&quot; y=&quot;77.4&quot; text-anchor=&quot;middle&quot;&gt;87&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M421.0,240 V76.6 Q421.0,72.6 425.0,72.6 H453.0 Q457.0,72.6 457.0,76.6 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 10,000 clients: 93k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;439.0&quot; y=&quot;66.6&quot; text-anchor=&quot;middle&quot;&gt;93&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;401.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;10,000 clients&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Acknowledgements (echoes) per second, in thousands. Higher is better.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;On acknowledgements, at 1,000 clients all three are within the normal run-to-run variation. From 5,000 on, PHP 8.1 falls behind: Node answers 21% to 29% more per second. With the JIT, PHP ties at 5,000 clients and is 7% behind at 10,000.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Broadcast deliveries per second at 1,000, 5,000 and 10,000 clients: PHP 8.1, PHP 8.5 with the JIT and Node.js&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 268&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;s1&quot; x=&quot;56&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;74&quot; y=&quot;21&quot;&gt;PHP 8.1&lt;/text&gt;
&lt;rect class=&quot;s3&quot; x=&quot;172&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;190&quot; y=&quot;21&quot;&gt;PHP 8.5 with JIT&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;318&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;336&quot; y=&quot;21&quot;&gt;Node.js&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;240.0&quot; x2=&quot;470&quot; y2=&quot;240.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;244.0&quot; text-anchor=&quot;end&quot;&gt;0&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;210.0&quot; x2=&quot;470&quot; y2=&quot;210.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;214.0&quot; text-anchor=&quot;end&quot;&gt;100&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;180.0&quot; x2=&quot;470&quot; y2=&quot;180.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;184.0&quot; text-anchor=&quot;end&quot;&gt;200&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;150.0&quot; x2=&quot;470&quot; y2=&quot;150.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;154.0&quot; text-anchor=&quot;end&quot;&gt;300&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;120.0&quot; x2=&quot;470&quot; y2=&quot;120.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;124.0&quot; text-anchor=&quot;end&quot;&gt;400&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;90.0&quot; x2=&quot;470&quot; y2=&quot;90.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;94.0&quot; text-anchor=&quot;end&quot;&gt;500&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;60.0&quot; x2=&quot;470&quot; y2=&quot;60.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;64.0&quot; text-anchor=&quot;end&quot;&gt;600&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;46&quot; text-anchor=&quot;end&quot;&gt;k/s&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M69.0,240 V117.4 Q69.0,113.4 73.0,113.4 H101.0 Q105.0,113.4 105.0,117.4 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 1,000 clients: 422k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;87.0&quot; y=&quot;107.4&quot; text-anchor=&quot;middle&quot;&gt;422&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M107.0,240 V82.6 Q107.0,78.6 111.0,78.6 H139.0 Q143.0,78.6 143.0,82.6 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 1,000 clients: 538k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125.0&quot; y=&quot;72.6&quot; text-anchor=&quot;middle&quot;&gt;538&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M145.0,240 V83.5 Q145.0,79.5 149.0,79.5 H177.0 Q181.0,79.5 181.0,83.5 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 1,000 clients: 535k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;163.0&quot; y=&quot;73.5&quot; text-anchor=&quot;middle&quot;&gt;535&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;1,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M207.0,240 V118.0 Q207.0,114.0 211.0,114.0 H239.0 Q243.0,114.0 243.0,118.0 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 5,000 clients: 420k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;225.0&quot; y=&quot;108.0&quot; text-anchor=&quot;middle&quot;&gt;420&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M245.0,240 V80.2 Q245.0,76.2 249.0,76.2 H277.0 Q281.0,76.2 281.0,80.2 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 5,000 clients: 546k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;263.0&quot; y=&quot;70.2&quot; text-anchor=&quot;middle&quot;&gt;546&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M283.0,240 V65.2 Q283.0,61.2 287.0,61.2 H315.0 Q319.0,61.2 319.0,65.2 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 5,000 clients: 596k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;301.0&quot; y=&quot;55.2&quot; text-anchor=&quot;middle&quot;&gt;596&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;263.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;5,000 clients&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M345.0,240 V124.0 Q345.0,120.0 349.0,120.0 H377.0 Q381.0,120.0 381.0,124.0 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, 10,000 clients: 400k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;363.0&quot; y=&quot;114.0&quot; text-anchor=&quot;middle&quot;&gt;400&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M383.0,240 V98.2 Q383.0,94.2 387.0,94.2 H415.0 Q419.0,94.2 419.0,98.2 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, 10,000 clients: 486k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;401.0&quot; y=&quot;88.2&quot; text-anchor=&quot;middle&quot;&gt;486&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M421.0,240 V95.5 Q421.0,91.5 425.0,91.5 H453.0 Q457.0,91.5 457.0,95.5 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, 10,000 clients: 495k/s&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;439.0&quot; y=&quot;85.5&quot; text-anchor=&quot;middle&quot;&gt;495&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;401.0&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;10,000 clients&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Broadcast deliveries per second, in thousands. Higher is better.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Broadcasts tell the same story. Without the JIT, Node delivers 1.2 to 1.4 times as many per second. With it, PHP ties at 1,000 and 10,000 clients and is 8% behind at 5,000.&lt;/p&gt;

&lt;p&gt;Throughput doesn&#039;t say how long a message takes to arrive. For that, I measured the latency of a broadcast to a room of a thousand clients, with 10,000 connected: 100 messages, one every 50 ms, timed from the request to the arrival at each member. The clients are spread over 10 containers, a thousand in each, so that no client process becomes the bottleneck. The p99 is the time by which 99% of the deliveries have arrived.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Broadcast latency to a room of 1,000 clients, with 10,000 connected: p50 and p99 of PHP 8.1, PHP 8.5 with JIT and Node.js&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 268&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;s1&quot; x=&quot;56&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;74&quot; y=&quot;21&quot;&gt;PHP 8.1&lt;/text&gt;
&lt;rect class=&quot;s3&quot; x=&quot;172&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;190&quot; y=&quot;21&quot;&gt;PHP 8.5 with JIT&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;318&quot; y=&quot;10&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;336&quot; y=&quot;21&quot;&gt;Node.js&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;240.0&quot; x2=&quot;470&quot; y2=&quot;240.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;244.0&quot; text-anchor=&quot;end&quot;&gt;0&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;195.0&quot; x2=&quot;470&quot; y2=&quot;195.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;199.0&quot; text-anchor=&quot;end&quot;&gt;5&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;150.0&quot; x2=&quot;470&quot; y2=&quot;150.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;154.0&quot; text-anchor=&quot;end&quot;&gt;10&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;105.0&quot; x2=&quot;470&quot; y2=&quot;105.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;109.0&quot; text-anchor=&quot;end&quot;&gt;15&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;56&quot; y1=&quot;60.0&quot; x2=&quot;470&quot; y2=&quot;60.0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;64.0&quot; text-anchor=&quot;end&quot;&gt;20&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;50&quot; y=&quot;46&quot; text-anchor=&quot;end&quot;&gt;ms&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M103.5,240 V177.9 Q103.5,173.9 107.5,173.9 H135.5 Q139.5,173.9 139.5,177.9 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, p50: 7.3 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;121.5&quot; y=&quot;167.9&quot; text-anchor=&quot;middle&quot;&gt;7.3&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M141.5,240 V181.7 Q141.5,177.7 145.5,177.7 H173.5 Q177.5,177.7 177.5,181.7 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, p50: 6.9 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;159.5&quot; y=&quot;171.7&quot; text-anchor=&quot;middle&quot;&gt;6.9&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M179.5,240 V187.4 Q179.5,183.4 183.5,183.4 H211.5 Q215.5,183.4 215.5,187.4 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, p50: 6.3 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;197.5&quot; y=&quot;177.4&quot; text-anchor=&quot;middle&quot;&gt;6.3&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;159.5&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;p50 (half of the deliveries)&lt;/text&gt;
&lt;path class=&quot;s1&quot; d=&quot;M310.5,240 V114.7 Q310.5,110.7 314.5,110.7 H342.5 Q346.5,110.7 346.5,114.7 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.1, p99: 14.4 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;328.5&quot; y=&quot;104.7&quot; text-anchor=&quot;middle&quot;&gt;14.4&lt;/text&gt;
&lt;path class=&quot;s3&quot; d=&quot;M348.5,240 V116.4 Q348.5,112.4 352.5,112.4 H380.5 Q384.5,112.4 384.5,116.4 V240 Z&quot; data-hover&gt;&lt;title&gt;PHP 8.5 with JIT, p99: 14.2 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;366.5&quot; y=&quot;106.4&quot; text-anchor=&quot;middle&quot;&gt;14.2&lt;/text&gt;
&lt;path class=&quot;s2&quot; d=&quot;M386.5,240 V118.3 Q386.5,114.3 390.5,114.3 H418.5 Q422.5,114.3 422.5,118.3 V240 Z&quot; data-hover&gt;&lt;title&gt;Node.js, p99: 14.0 ms&lt;/title&gt;&lt;/path&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;404.5&quot; y=&quot;108.3&quot; text-anchor=&quot;middle&quot;&gt;14.0&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;366.5&quot; y=&quot;260&quot; text-anchor=&quot;middle&quot;&gt;p99 (99% of the deliveries)&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Broadcast latency to a room of a thousand clients, with 10,000 connected, in milliseconds. Lower is better.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The three are practically the same, around 7 ms at p50 and 14 ms at p99, a difference below the run-to-run variation. At this load, none of the servers is the bottleneck: the server and the clients share the same machine and Docker&#039;s network, and that environment sets the time. Telling one server from the other would take running the clients on other machines.&lt;/p&gt;

&lt;p&gt;PHP leaves OPcache off on the command line (&lt;code&gt;opcache.enable_cli=0&lt;/code&gt;), and a Workerman server is a CLI process. So, without any configuration, it runs interpreted, while V8, Node&#039;s engine, JIT-compiles the hottest code without any configuration. For a fair comparison, the JIT has to be on:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;; PHP 8.1 to 8.4 also need zend_extension=opcache, PHP 8.5 builds it in
opcache.enable_cli=1
opcache.jit=tracing
opcache.jit_buffer_size=128M
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Comparing PHP 8.1 without the JIT to 8.5 with it changes two things at once, so I also measured the other two combinations. The gain comes from the JIT, not the version: with the JIT, PHP 8.1 answers 94,000 acknowledgements per second with 5,000 clients and 85,000 with 10,000, nearly the same as 8.5 (96,000 and 87,000). And 8.5 without the JIT stays level with 8.1 on acknowledgements and delivers 4% to 14% more broadcasts.&lt;/p&gt;

&lt;p&gt;The profiler shows where the JIT acts. The largest cost of a delivery is the write system call on the socket (about 1.5 µs), Workerman adds about 0.25 µs and the package&#039;s code about 0.6 µs. The JIT only speeds up that last part. That&#039;s why a single event to 10,000 clients, which is basically one write per client, barely changes: 133,000 deliveries per second without the JIT, 138,000 with it, and 154,000 on Node.&lt;/p&gt;

&lt;p&gt;The full methodology and the scripts to run it on your machine are in &lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/blob/main/docs/performance.md&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;docs/performance.md&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;soak-test&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Continuous load test without leaking memory&lt;/h2&gt;

&lt;p&gt;A WebSocket server stays up for days, so memory has to stay flat while clients come and go. The soak test simulates that: thousands of clients connecting and leaving, over long-polling, WebSocket or the upgrade, with binary data and rooms, and 30% of them dropping their transport to test recovery. Every 200 ms a numbered broadcast goes out, and every client checks whether it lost, repeated or got anything out of order.&lt;/p&gt;

&lt;p&gt;The result of 20 minutes with 2,000 clients (about 1,850 connected at a time):&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;Connections opened&lt;/td&gt;
  &lt;td&gt;81,615 (about 68 per second)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;Transports dropped&lt;/td&gt;
  &lt;td&gt;17,615, with 17,560 recovered and none failed (the rest ended first)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;Numbered messages received&lt;/td&gt;
  &lt;td&gt;11,012,036, none lost, repeated or out of order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;Memory (heap) during the test&lt;/td&gt;
  &lt;td&gt;53.1 to 54.8 MB, flat from start to end&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;Memory after the clients left&lt;/td&gt;
  &lt;td&gt;7.8 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The most useful part was what it found before it passed: up to version 0.5.1, every closed connection left about 7 KB behind, because the map from sessions to clients was never cleared. Memory went from 66 MB to 812 MB in 17 minutes, with the CPU at 100%. No unit test caught it. The fix shipped in 0.5.2.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;building-with-ai&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Building it with AI&lt;/h2&gt;

&lt;p&gt;I built the package together with Claude (Opus 5.5). What made that workable was the problem having a clear reference: the protocol is documented, the official server is there to compare against and the compliance suites say objectively whether the implementation is right. Every step had a definition of done that didn&#039;t depend on anyone&#039;s opinion, not mine and not the AI&#039;s.&lt;/p&gt;

&lt;p&gt;What I take from the experience:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Real tests are worth more than review.&lt;/strong&gt; The code passed every test and had a memory leak. Only the soak test found it;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Intermittent bugs take patience.&lt;/strong&gt; One test in the official suite failed once every 60 runs. The cause: Workerman&#039;s &lt;code&gt;select()&lt;/code&gt; reads ready sockets in descriptor order, not arrival order, so a polling request sent right after the upgrade was sometimes read before it. Finding that took more work than many whole features;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Measure before optimizing.&lt;/strong&gt; The package&#039;s optimizations came from profiling, not guesses. Grouping each connection&#039;s writes doubled broadcast deliveries, but grouping the first write too made a single event to many clients 30% slower and was dropped.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;next-steps&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Current state and next steps&lt;/h2&gt;

&lt;p&gt;The package is on &lt;a href=&quot;https://packagist.org/packages/marcosmarcolin/socket.io-server&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Packagist&lt;/a&gt;, at version 0.x, and works on PHP 8.1 to 8.5, and also on the event loop of Swoole, the asynchronous programming extension for PHP, for those who already use it. The next step is seeing it run in real applications. I&#039;ve also &lt;a href=&quot;https://github.com/socketio/socket.io-website/pull/556&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;opened a pull request&lt;/a&gt; to add the package, along with phpsocket.io, to the list of server implementations on the Socket.IO website, which is still waiting for review.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;conclusion&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;With socket.io-server, a PHP application no longer needs a Node.js service on the side just to use the current version of Socket.IO. Everything can stay on the same stack, with the official client and the features that came after 2.x.&lt;/p&gt;

&lt;p&gt;Two lessons apply even if you never use the package. If you run long-lived PHP on the command line, check whether OPcache and the JIT are on, because by default they aren&#039;t. And sustained load testing catches what unit tests don&#039;t.&lt;/p&gt;

&lt;p&gt;To try it, the migration guide and the repository&#039;s examples are a good place to start.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;faq&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;FAQ&lt;/h2&gt;

&lt;h3&gt;Can I use Socket.IO v4 with PHP?&lt;/h3&gt;

&lt;p&gt;Yes. socket.io-server is a Socket.IO v4 server in PHP, built on Workerman, that works with the official &lt;code&gt;socket.io-client&lt;/code&gt; v3 and v4. It runs as a long-lived PHP process, separate from PHP-FPM.&lt;/p&gt;

&lt;h3&gt;Does phpsocket.io support socket.io-client v3 and v4?&lt;/h3&gt;

&lt;p&gt;No. phpsocket.io implements Engine.IO v3 and only works with the 1.x and 2.x clients. For v3 and v4, phpsocket.io&#039;s own README points to socket.io-server, which has a migration guide.&lt;/p&gt;

&lt;h2&gt;Links&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;socket.io-server on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://packagist.org/packages/marcosmarcolin/socket.io-server&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;socket.io-server on Packagist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/blob/main/docs/performance.md&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Performance and limits (full methodology)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/marcosmarcolin/socket.io-server/blob/main/docs/migrating-from-phpsocket.io.md&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Migrating from phpsocket.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/walkor/phpsocket.io&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;phpsocket.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://socket.io/docs/v4/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Socket.IO v4 documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php2shell-critical-php-vulnerability-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php2shell-critical-php-vulnerability-en" />
            <title>PHP2Shell: the critical PHP vulnerability and how to stay safe</title>
            <published>2026-10-27T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">What PHP2Shell (CVE-2026-109618 and CVE-2026-109619) is, how severe it really is, what was exaggerated and how to check if your server is vulnerable.</summary>
            <content type="html">&lt;p&gt;Well, wouldn&#039;t you know it: PHP is once again one of the most talked-about topics on the internet worldwide. 🐘&lt;/p&gt;

&lt;p&gt;Anyone who says PHP is dead must have been surprised: last week it made mainstream news, led European governments to take websites offline, and even the FBI and the NSA issued alerts. Only this time, the reason wasn&#039;t a new feature.&lt;/p&gt;

&lt;p&gt;PHP shipped an emergency release to fix two vulnerabilities that allow &lt;strong&gt;unauthenticated remote code execution&lt;/strong&gt;, nicknamed &lt;strong&gt;PHP2Shell&lt;/strong&gt;: CVE-2026-109618 and CVE-2026-109619.&lt;/p&gt;

&lt;p&gt;If you don&#039;t have time to read the rest, take just this: &lt;strong&gt;if your server runs PHP handling web requests, update to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or later).&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; on November 19, PHP fixed 17 more flaws, and some of them are follow-ups to PHP2Shell. The minimum versions are now 8.5.13, 8.4.28, 8.3.37 and 8.2.36. The details are in the post &lt;a href=&quot;/en/blog/php-security-release-november-2026-en&quot;&gt;PHP fixes 7 critical flaws: what to do about 8.5.13 and 8.4.28&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Table of contents&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-a-cve&quot;&gt;First, what is a CVE?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-happened&quot;&gt;What happened&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-two-flaws&quot;&gt;The two flaws&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#who-is-at-risk&quot;&gt;Who is at risk and how severe is it?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#fake-news&quot;&gt;Fake news and exaggerations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-fix&quot;&gt;How PHP fixed it&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#am-i-vulnerable&quot;&gt;How do I know if I&#039;m vulnerable?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#cant-update-now&quot;&gt;I can&#039;t update right now, what now?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#is-php-dead&quot;&gt;So is PHP done for? Of course not&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#stay-up-to-date&quot;&gt;Staying up to date is not optional&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;what-is-a-cve&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;First, what is a CVE?&lt;/h2&gt;

&lt;p&gt;If you&#039;ve never had to deal with this, three acronyms will show up a lot here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CVE&lt;/strong&gt; (&lt;em&gt;Common Vulnerabilities and Exposures&lt;/em&gt;) is the &quot;ID card&quot; of a security flaw. Every known vulnerability gets a unique identifier, like &lt;code&gt;CVE-2026-109618&lt;/code&gt;: the year and a number. That way, everyone (developers, companies, distros and security tools) talks about the same flaw without confusion;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CVSS&lt;/strong&gt; (&lt;em&gt;Common Vulnerability Scoring System&lt;/em&gt;) is the severity score, from 0 to 10. Anything at 9 or above is considered critical;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RCE&lt;/strong&gt; (&lt;em&gt;Remote Code Execution&lt;/em&gt;) is the worst kind of flaw: the attacker can run code on your server over the network, as if they had access to it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, when someone says &quot;critical CVE with RCE&quot;, they mean: a catalogued flaw, severity at the top of the scale, and the attacker can take over the server.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;what-happened&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What happened&lt;/h2&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;PHP2Shell timeline between October 17 and 26, 2026&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 350&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;line class=&quot;grid&quot; x1=&quot;110&quot; y1=&quot;30&quot; x2=&quot;110&quot; y2=&quot;320&quot;/&gt;
&lt;circle class=&quot;s2&quot; cx=&quot;110&quot; cy=&quot;30&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 17: exploitation attempt recorded by Amazon&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;34&quot; text-anchor=&quot;end&quot;&gt;Oct 17&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;34&quot;&gt;Amazon records an exploitation attempt&lt;/text&gt;
&lt;circle class=&quot;s2&quot; cx=&quot;110&quot; cy=&quot;88&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 20: CVE IDs leak with the wrong score and a PoC video is published by mistake&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;92&quot; text-anchor=&quot;end&quot;&gt;Oct 20&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;92&quot;&gt;CVE IDs leak with the wrong score (10)&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125&quot; y=&quot;108&quot;&gt;PoC video published by mistake&lt;/text&gt;
&lt;circle class=&quot;s1&quot; cx=&quot;110&quot; cy=&quot;146&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 21: PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;150&quot; text-anchor=&quot;end&quot;&gt;Oct 21&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;150&quot;&gt;Fix: 8.5.12, 8.4.27, 8.3.36, 8.2.35&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125&quot; y=&quot;166&quot;&gt;Advisories published on GitHub&lt;/text&gt;
&lt;circle class=&quot;s1&quot; cx=&quot;110&quot; cy=&quot;204&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 23: informational advisory about CVE-2026-115560&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;208&quot; text-anchor=&quot;end&quot;&gt;Oct 23&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;208&quot;&gt;Advisory about CVE-2026-115560&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125&quot; y=&quot;224&quot;&gt;Unusual setup, simple mitigation&lt;/text&gt;
&lt;circle class=&quot;s2&quot; cx=&quot;110&quot; cy=&quot;262&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 24: RCE confirmed on a honeypot&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;266&quot; text-anchor=&quot;end&quot;&gt;Oct 24&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;266&quot;&gt;RCE confirmed on a honeypot&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125&quot; y=&quot;282&quot;&gt;Apache mod_php with PHP 8.4.26&lt;/text&gt;
&lt;circle class=&quot;s2&quot; cx=&quot;110&quot; cy=&quot;320&quot; r=&quot;7&quot; data-hover&gt;&lt;title&gt;Oct 26: CISA adds the CVEs to the KEV catalog&lt;/title&gt;&lt;/circle&gt;
&lt;text class=&quot;t-b&quot; x=&quot;95&quot; y=&quot;324&quot; text-anchor=&quot;end&quot;&gt;Oct 26&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;324&quot;&gt;CISA adds them to the KEV catalog&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;125&quot; y=&quot;340&quot;&gt;Known exploited vulnerabilities&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Orange: attack or leak. Blue: PHP&#039;s response.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The release was scheduled for October 22, but on the 20th the CVE IDs leaked online with the wrong score, and shortly after Calif, the company that reported the flaws, mistakenly published a video of the exploit. PHP moved everything up by a day.&lt;/p&gt;

&lt;p&gt;That&#039;s when the story left the dev bubble. CERT-EU recommended taking affected sites offline, and governments in Finland, the Netherlands, France and Germany shut down official pages. In the United States, the &lt;a href=&quot;https://x.com/FBICyberDiv/status/2112921648252719420&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;FBI issued an alert&lt;/a&gt; recommending an immediate update and, if that&#039;s not possible, taking the system offline. Here in Brazil, Anatel and several courts suspended access to SEI, a government document system, as a precaution. The press covered it everywhere, including g1, Brazil&#039;s largest news portal, which reported &lt;a href=&quot;https://g1.globo.com/tecnologia/ciberseguranca/noticia/2026/10/23/brecha-no-php-que-tirou-sites-do-ar-foi-descoberta-ha-dois-anos-responsavel-cita-falta-de-recursos-para-corrigi-la.ghtml&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;that the flaw had been discovered two years earlier&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And that&#039;s true. According to the &lt;a href=&quot;https://thephp.foundation/blog/2026/10/21/todays-php-security-release-and-how-were-strengthening-php-security/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP Foundation&lt;/a&gt;, the first signs of the problem showed up in a 2024 audit, but the fix stalled for months. It only became top priority in August 2026, when Calif and OpenAI reported the same flaw, both using AI in their research. The Foundation itself called the delay &lt;strong&gt;&quot;a structural failure&quot;&lt;/strong&gt;, caused by a lack of resources and a slow decision process. I found that very honest of them.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;the-two-flaws&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The two flaws&lt;/h2&gt;

&lt;h3&gt;CVE-2026-109618: the OOM that leaves a mess behind&lt;/h3&gt;

&lt;p&gt;When PHP hits the &lt;code&gt;memory_limit&lt;/code&gt;, it uses &lt;code&gt;longjmp()&lt;/code&gt; to abandon the request on the spot. The problem is that, at some points, the request memory &lt;strong&gt;hasn&#039;t been fully initialized yet&lt;/strong&gt;, and shutdown later reads that memory as if it were valid.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Flow of CVE-2026-109618, from the request to remote code execution&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 384&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;defs&gt;&lt;marker id=&quot;arr-oom&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path class=&quot;arrow&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;10&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;35&quot; text-anchor=&quot;middle&quot;&gt;Attacker sends a multipart request&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;50&quot; x2=&quot;240&quot; y2=&quot;70&quot; marker-end=&quot;url(#arr-oom)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;72&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;97&quot; text-anchor=&quot;middle&quot;&gt;PHP builds $_POST and $_FILES (half-initialized memory)&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;112&quot; x2=&quot;240&quot; y2=&quot;132&quot; marker-end=&quot;url(#arr-oom)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;134&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;159&quot; text-anchor=&quot;middle&quot;&gt;Headers and nested fields exceed memory_limit&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;174&quot; x2=&quot;240&quot; y2=&quot;194&quot; marker-end=&quot;url(#arr-oom)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;40&quot; y=&quot;196&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;221&quot; text-anchor=&quot;middle&quot;&gt;longjmp(): bails out without undoing half-done work&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;236&quot; x2=&quot;240&quot; y2=&quot;256&quot; marker-end=&quot;url(#arr-oom)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;40&quot; y=&quot;258&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;283&quot; text-anchor=&quot;middle&quot;&gt;mod_php runs shutdown even after the failure&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;240&quot; y1=&quot;298&quot; x2=&quot;240&quot; y2=&quot;318&quot; marker-end=&quot;url(#arr-oom)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;40&quot; y=&quot;320&quot; width=&quot;400&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;240&quot; y=&quot;345&quot; text-anchor=&quot;middle&quot;&gt;Shutdown reads invalid memory: code execution&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;240&quot; y=&quot;378&quot; text-anchor=&quot;middle&quot;&gt;All of this happens before a single line of your application runs&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;CVE-2026-109618: OOM interrupts PHP in the middle of initialization.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;On Apache with mod_php, this happens while the request body is being parsed. In other words, it doesn&#039;t matter whether your code is secure: having PHP answer HTTP is enough. Details in advisory &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-w8hw-w9fx-j79w&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;CVE-2026-109619: the garbage left for the next request&lt;/h3&gt;

&lt;p&gt;PHP workers handle many requests in the same process. If a fatal error or an OOM interrupts a request, some global pointers aren&#039;t reset. The memory is freed, but the &lt;strong&gt;next request on the same worker&lt;/strong&gt; uses that stale pointer. A classic &lt;em&gt;use after free&lt;/em&gt;.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Flow of CVE-2026-109619 across two requests on the same worker&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 330&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;defs&gt;&lt;marker id=&quot;arr-uaf&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path class=&quot;arrow&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;box&quot; x=&quot;6&quot; y=&quot;6&quot; width=&quot;468&quot; height=&quot;318&quot; rx=&quot;10&quot; fill-opacity=&quot;0&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;20&quot; y=&quot;26&quot;&gt;Same PHP worker (reused process)&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;125&quot; y=&quot;54&quot; text-anchor=&quot;middle&quot;&gt;Request A&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;355&quot; y=&quot;54&quot; text-anchor=&quot;middle&quot;&gt;Request B&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;30&quot; y=&quot;66&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;85&quot; text-anchor=&quot;middle&quot;&gt;Stores a pointer&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;101&quot; text-anchor=&quot;middle&quot;&gt;in global state&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;125&quot; y1=&quot;110&quot; x2=&quot;125&quot; y2=&quot;128&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;30&quot; y=&quot;130&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;149&quot; text-anchor=&quot;middle&quot;&gt;Fatal error or OOM:&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;165&quot; text-anchor=&quot;middle&quot;&gt;the reset is skipped&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;125&quot; y1=&quot;174&quot; x2=&quot;125&quot; y2=&quot;192&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;rect class=&quot;box&quot; x=&quot;30&quot; y=&quot;194&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;213&quot; text-anchor=&quot;middle&quot;&gt;Request memory&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;125&quot; y=&quot;229&quot; text-anchor=&quot;middle&quot;&gt;is freed&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;260&quot; y=&quot;66&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;355&quot; y=&quot;85&quot; text-anchor=&quot;middle&quot;&gt;INI or upload progress&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;355&quot; y=&quot;101&quot; text-anchor=&quot;middle&quot;&gt;before initialization&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;355&quot; y1=&quot;110&quot; x2=&quot;355&quot; y2=&quot;128&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;260&quot; y=&quot;130&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;355&quot; y=&quot;149&quot; text-anchor=&quot;middle&quot;&gt;Uses the stale pointer&lt;/text&gt;
&lt;text class=&quot;t&quot; x=&quot;355&quot; y=&quot;165&quot; text-anchor=&quot;middle&quot;&gt;(use after free)&lt;/text&gt;
&lt;line class=&quot;line&quot; x1=&quot;355&quot; y1=&quot;174&quot; x2=&quot;355&quot; y2=&quot;192&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;rect class=&quot;box-bad&quot; x=&quot;260&quot; y=&quot;194&quot; width=&quot;190&quot; height=&quot;44&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;355&quot; y=&quot;213&quot; text-anchor=&quot;middle&quot;&gt;Heap manipulated:&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;355&quot; y=&quot;229&quot; text-anchor=&quot;middle&quot;&gt;code execution&lt;/text&gt;
&lt;rect class=&quot;box&quot; x=&quot;130&quot; y=&quot;266&quot; width=&quot;220&quot; height=&quot;40&quot; rx=&quot;6&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;240&quot; y=&quot;291&quot; text-anchor=&quot;middle&quot;&gt;Global pointer to freed memory&lt;/text&gt;
&lt;path class=&quot;line&quot; d=&quot;M125,238 L125,286 L128,286&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;path class=&quot;line&quot; d=&quot;M350,286 L464,286 L464,152 L454,152&quot; marker-end=&quot;url(#arr-uaf)&quot;/&gt;
&lt;/svg&gt;
&lt;figcaption&gt;CVE-2026-109619: request A leaves the garbage, request B consumes it.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The confirmed cases involve PHP 8.5&#039;s &lt;code&gt;fatal_error_backtraces&lt;/code&gt; and &lt;em&gt;session upload progress&lt;/em&gt;, which used to be enabled by default (since the November 19 releases, it ships disabled). And one important detail: using &lt;code&gt;@&lt;/code&gt; or turning off &lt;code&gt;display_errors&lt;/code&gt; &lt;strong&gt;does not protect you&lt;/strong&gt;. Details in advisory &lt;a href=&quot;https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;GHSA-6wmf-4rv5-p3rp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;who-is-at-risk&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Who is at risk and how severe is it?&lt;/h2&gt;

&lt;p&gt;According to PHP, &lt;strong&gt;every installation that handles web requests&lt;/strong&gt;. The risk depends on the SAPI (the way PHP runs on the server) and is highest on mod_php:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;SAPI&lt;/th&gt;
  &lt;th&gt;CVE-2026-109618 (OOM)&lt;/th&gt;
  &lt;th&gt;CVE-2026-109619 (global state)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;Apache mod_php&lt;/td&gt;
  &lt;td&gt;&lt;strong&gt;Exploit confirmed&lt;/strong&gt;, independent of the application&lt;/td&gt;
  &lt;td&gt;&lt;strong&gt;Exploit confirmed&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;PHP-FPM&lt;/td&gt;
  &lt;td&gt;&lt;strong&gt;RCE confirmed&lt;/strong&gt;, through application code&lt;/td&gt;
  &lt;td&gt;&lt;strong&gt;RCE validated&lt;/strong&gt; via upload progress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;FrankenPHP, LiteSpeed, php-cgi&lt;/td&gt;
  &lt;td&gt;Likely or in scope of the advisory&lt;/td&gt;
  &lt;td&gt;Conditional&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Both were rated &lt;strong&gt;CVSS v4.0 9.2&lt;/strong&gt;:&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;CVSS scale from 0 to 10 comparing the official 9.2 score with the 10 that circulated in the leak&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 150&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;rect class=&quot;crit&quot; x=&quot;420&quot; y=&quot;18&quot; width=&quot;30&quot; height=&quot;84&quot; opacity=&quot;0.12&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;435&quot; y=&quot;12&quot; text-anchor=&quot;middle&quot;&gt;critical&lt;/text&gt;
&lt;line class=&quot;grid&quot; x1=&quot;150&quot; y1=&quot;18&quot; x2=&quot;150&quot; y2=&quot;102&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;270&quot; y1=&quot;18&quot; x2=&quot;270&quot; y2=&quot;102&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;360&quot; y1=&quot;18&quot; x2=&quot;360&quot; y2=&quot;102&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;420&quot; y1=&quot;18&quot; x2=&quot;420&quot; y2=&quot;102&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;450&quot; y1=&quot;18&quot; x2=&quot;450&quot; y2=&quot;102&quot;/&gt;
&lt;rect class=&quot;s1&quot; x=&quot;150&quot; y=&quot;30&quot; width=&quot;276&quot; height=&quot;24&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;Official PHP score: CVSS v4.0 9.2&lt;/title&gt;&lt;/rect&gt;
&lt;text class=&quot;t&quot; x=&quot;140&quot; y=&quot;47&quot; text-anchor=&quot;end&quot;&gt;Official (PHP)&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;242&quot; y=&quot;47&quot; style=&quot;fill:#fff&quot;&gt;9.2&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;150&quot; y=&quot;66&quot; width=&quot;300&quot; height=&quot;24&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;What circulated in the leak: CVSS 10&lt;/title&gt;&lt;/rect&gt;
&lt;text class=&quot;t&quot; x=&quot;140&quot; y=&quot;83&quot; text-anchor=&quot;end&quot;&gt;Leak&lt;/text&gt;
&lt;text class=&quot;t-b&quot; x=&quot;242&quot; y=&quot;83&quot; style=&quot;fill:#fff&quot;&gt;10&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;150&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;0&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;270&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;4&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;360&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;7&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;420&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;9&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;450&quot; y=&quot;120&quot; text-anchor=&quot;middle&quot;&gt;10&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;210&quot; y=&quot;140&quot; text-anchor=&quot;middle&quot;&gt;low&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;315&quot; y=&quot;140&quot; text-anchor=&quot;middle&quot;&gt;medium&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;390&quot; y=&quot;140&quot; text-anchor=&quot;middle&quot;&gt;high&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;It&#039;s not a 10, but it&#039;s still at the top of the scale.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;It&#039;s not a 10 because exploiting it is complex (more on that below). But in practice, I wouldn&#039;t give that difference much weight: it&#039;s unauthenticated RCE in one of the most widely used languages on the web. And the attack also leaks server memory, which can expose sessions and passwords even when it doesn&#039;t get to run code. Exploitation has already been confirmed, and CISA added both to its catalog of known exploited vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;fake-news&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Fake news and exaggerations&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&quot;The technical details leaked.&quot;&lt;/strong&gt; False. Only the CVE IDs leaked. What helped attackers was the video published by mistake.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&quot;The flaw took down the internet.&quot;&lt;/strong&gt; An exaggeration. Sites were taken offline on purpose, as a precaution, not because of attacks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&quot;It affects everything back to PHP 5.&quot;&lt;/strong&gt; True, according to watchTowr. But from 7.3 down there&#039;s no fix from PHP, only from distros and LTS vendors.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&quot;There&#039;s a PR on GitHub fixing it, just apply it.&quot;&lt;/strong&gt; Careful. The third-party PRs were all closed without being merged. Don&#039;t apply patches of unknown origin in production.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&quot;Another critical unpatched RCE just dropped.&quot;&lt;/strong&gt; An exaggeration. CVE-2026-115560 requires a very unusual setup, and &lt;a href=&quot;https://www.php.net/archive/2026.php#2026-10-23-1&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP will fix it in the regular release cycle&lt;/a&gt;. Turning off &lt;code&gt;session.upload_progress.enabled&lt;/code&gt; already takes care of it. It was fixed &lt;a href=&quot;/en/blog/php-security-release-november-2026-en&quot;&gt;in the November 19 release&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;the-fix&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How PHP fixed it&lt;/h2&gt;

&lt;p&gt;I went looking for the PR with the fix and found out that &lt;strong&gt;there is no public PR&lt;/strong&gt;. Security fixes in PHP are developed privately and land directly as a commit on release day. In this case, it was commit &lt;a href=&quot;https://github.com/php/php-src/commit/3584a98bda0f2c0d367255b046798b0d3a221a19&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;3584a98&lt;/a&gt;, &lt;strong&gt;&quot;Avoid state corruption via bailout&quot;&lt;/strong&gt;, which closes both CVEs.&lt;/p&gt;

&lt;p&gt;And it&#039;s not small: &lt;strong&gt;more than 300 files&lt;/strong&gt; and about &lt;strong&gt;10,700 lines added&lt;/strong&gt;, much of it tests simulating OOM across practically the entire standard library. In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;the &lt;code&gt;longjmp()&lt;/code&gt; on OOM was removed&lt;/strong&gt;, and PHP now stops execution at a safe point in the VM;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;global state is now properly reset&lt;/strong&gt; before the request memory is freed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Foundation also announced more people on the security team, new audits and majority voting instead of consensus, so this doesn&#039;t stall again. And it made a request I&#039;ll echo here: if your company depends on PHP, take a look at the &lt;a href=&quot;https://thephp.foundation/sponsor/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;sponsorship program&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;am-i-vulnerable&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How do I know if I&#039;m vulnerable?&lt;/h2&gt;

&lt;p&gt;You&#039;re protected if you&#039;re on one of these versions or later:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt;Branch&lt;/th&gt;
  &lt;th&gt;Fixed version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;8.5&lt;/td&gt;
  &lt;td&gt;8.5.12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.4&lt;/td&gt;
  &lt;td&gt;8.4.27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.3&lt;/td&gt;
  &lt;td&gt;8.3.36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;8.2&lt;/td&gt;
  &lt;td&gt;8.2.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;7.4, 8.0 and 8.1&lt;/td&gt;
  &lt;td&gt;No release, only backport branches to build yourself: &lt;a href=&quot;https://github.com/php/php-src/tree/PHP-7.4-CVE-2026-109618-109619&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;7.4&lt;/a&gt;, &lt;a href=&quot;https://github.com/php/php-src/tree/PHP-8.0-CVE-2026-109618-109619&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;8.0&lt;/a&gt; and &lt;a href=&quot;https://github.com/php/php-src/tree/PHP-8.1-CVE-2026-109618-109619&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;8.1&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;7.3 or older&lt;/td&gt;
  &lt;td&gt;No fix from PHP, only via distros or LTS vendors&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;If you use Debian or Ubuntu with &lt;strong&gt;Ondřej Surý&lt;/strong&gt;&#039;s packages (&lt;code&gt;ppa:ondrej/php&lt;/code&gt; or &lt;code&gt;deb.sury.org&lt;/code&gt;), he has already backported the fix to 5.6, 7.4, 8.0 and 8.1, for free. For 7.0 to 7.3, there are paid options such as Freexian, TuxCare and Ubuntu Pro (&lt;a href=&quot;https://sansec.io/research/php2shell&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Sansec put together the list&lt;/a&gt;). The official &lt;code&gt;php&lt;/code&gt; Docker image, on the other hand, gets no fix for 8.1 or older.&lt;/p&gt;

&lt;p&gt;To check, create a temporary file on the server, open it in the browser (so it runs on the same SAPI as your site) and &lt;strong&gt;delete it right after&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php
$fixed = [&#039;8.6&#039; =&amp;gt; &#039;8.6.0RC4&#039;, &#039;8.5&#039; =&amp;gt; &#039;8.5.12&#039;, &#039;8.4&#039; =&amp;gt; &#039;8.4.27&#039;, &#039;8.3&#039; =&amp;gt; &#039;8.3.36&#039;, &#039;8.2&#039; =&amp;gt; &#039;8.2.35&#039;];
$branch = PHP_MAJOR_VERSION . &#039;.&#039; . PHP_MINOR_VERSION;

echo &#039;Version: &#039;, PHP_VERSION, &#039; | SAPI: &#039;, PHP_SAPI, PHP_EOL;

if (!isset($fixed[$branch])) {
    echo &quot;Unsupported branch: there is no official release with the fix&quot;, PHP_EOL;
} elseif (version_compare(PHP_VERSION, $fixed[$branch], &#039;&amp;lt;&#039;)) {
    echo &quot;VULNERABLE: update to {$fixed[$branch]} or later&quot;, PHP_EOL;
} else {
    echo &quot;Version includes the fix&quot;, PHP_EOL;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If &lt;code&gt;SAPI&lt;/code&gt; shows &lt;code&gt;apache2handler&lt;/code&gt;, you&#039;re on mod_php, the most exposed setup. To scan many sites at once, ProjectDiscovery published a &lt;a href=&quot;https://projectdiscovery.io/research/php2shell&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Nuclei template&lt;/a&gt; that only reads the version from the header, without exploiting anything.&lt;/p&gt;

&lt;p&gt;A few things to watch out for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;distro packages&lt;/strong&gt; (Debian, Ubuntu, RHEL) backport fixes without changing the version number. Check your distribution&#039;s security advisory;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Docker images don&#039;t update themselves&lt;/strong&gt;: run &lt;code&gt;docker pull&lt;/code&gt;, rebuild and deploy;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;restart every worker&lt;/strong&gt; after updating. An old process keeps running the old binary;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;avoid the &quot;tests&quot; going around on GitHub&lt;/strong&gt; that do active probing. Many of them crash the worker on purpose. The version and the SAPI already tell you whether you&#039;re vulnerable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;What if I&#039;ve already been attacked?&lt;/h3&gt;

&lt;p&gt;Look in your logs for Apache or PHP-FPM spawning &lt;code&gt;sh&lt;/code&gt;, &lt;code&gt;curl&lt;/code&gt; or &lt;code&gt;wget&lt;/code&gt;, User-Agents containing &quot;php2shell&quot; or the CVE number, and spikes of &lt;code&gt;Allowed memory size exhausted&lt;/code&gt;. Found something? Treat it as an incident, not just an update.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;cant-update-now&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;I can&#039;t update right now, what now?&lt;/h2&gt;

&lt;p&gt;PHP published temporary mitigations. They &lt;strong&gt;reduce&lt;/strong&gt; the risk, but don&#039;t solve it:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;; php.ini, FPM pool or server config
session.upload_progress.enabled = 0
memory_limit = -1          ; via php_admin_value
post_max_size = 8M         ; 32M if you need uploads
upload_max_filesize = 2M
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On PHP 8.5, also set &lt;code&gt;fatal_error_backtraces=0&lt;/code&gt;, limit request sizes in Nginx or Apache and restart every worker. Yes, &lt;code&gt;memory_limit = -1&lt;/code&gt; looks strange, but the exploit relies precisely on hitting that limit in a predictable way. It&#039;s a stopgap, not a solution.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;is-php-dead&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;So is PHP done for? Of course not&lt;/h2&gt;

&lt;p&gt;With so many headlines, some people are already saying &quot;it&#039;s time to drop PHP&quot;. Easy there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This flaw is not easy to exploit.&lt;/strong&gt; The exploit depends on memory layout, the build and the number of workers. The first confirmed RCE in the wild was in a deliberately favorable environment, with a single worker, and the PoCs that circulated before the fix didn&#039;t work. That&#039;s no reason to relax, but it&#039;s also not a case of &quot;anyone can break into any PHP site with one command&quot;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And it wasn&#039;t just PHP.&lt;/strong&gt; That same week, Node.js fixed &lt;a href=&quot;https://www.akamai.com/blog/security-research/inside-node2shell-closer-look-cve-2026-111497&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Node2Shell&lt;/a&gt; (CVE-2026-111497), a flaw in the Brotli decoder that also allows remote code execution. Express 5, Koa and &lt;code&gt;fetch()&lt;/code&gt; itself decompress Brotli by default. And since the problem is in Google&#039;s library, &lt;a href=&quot;https://thehackernews.com/2026/10/brotli-decoder-flaw-behind-nodejs-rce.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;it also hit Bun, Python, .NET and other tools&lt;/a&gt;. Including PHP itself on Windows, which got new builds because of it.&lt;/p&gt;

&lt;p&gt;What&#039;s happening is bigger than any one language: AI has changed the pace of security, on both sides. It&#039;s finding old flaws across the whole ecosystem (PHP has published 15 CVEs since July, and the Node.js flaw was also reported by an AI tool), and it sped up the response: the Foundation now uses AI to validate reports and exploits and to group the ones that share a root cause. But the fix is still human work, in their words, &lt;em&gt;&quot;a person makes every call and works on every patch&quot;&lt;/em&gt;. And the same AI produced more than 100 invalid or duplicate reports, and it&#039;s in attackers&#039; hands too.&lt;/p&gt;

&lt;p&gt;A mature language isn&#039;t one that never has flaws, it&#039;s one that fixes them quickly and transparently when they show up.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;stay-up-to-date&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Staying up to date is not optional&lt;/h2&gt;

&lt;p&gt;For me, this is the main lesson. Anyone on a supported branch just had to roll out a patch. Anyone on 8.1 or older got no release: at best a backport branch to build by hand or a maintainer&#039;s package, and from 7.3 down, not even that from PHP. And that&#039;s not a small group: Mallory counted about &lt;strong&gt;884,000 exposed servers&lt;/strong&gt; in that situation the day before the fix.&lt;/p&gt;

&lt;figure class=&quot;viz&quot; role=&quot;img&quot; aria-label=&quot;Support lifecycle of PHP 8.2 to 8.5 with today&#039;s date marked&quot;&gt;
&lt;svg viewBox=&quot;0 0 480 215&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
&lt;line class=&quot;grid&quot; x1=&quot;86.7&quot; y1=&quot;22&quot; x2=&quot;86.7&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;140&quot; y1=&quot;22&quot; x2=&quot;140&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;193.3&quot; y1=&quot;22&quot; x2=&quot;193.3&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;246.7&quot; y1=&quot;22&quot; x2=&quot;246.7&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;300&quot; y1=&quot;22&quot; x2=&quot;300&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;353.3&quot; y1=&quot;22&quot; x2=&quot;353.3&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;406.7&quot; y1=&quot;22&quot; x2=&quot;406.7&quot; y2=&quot;162&quot;/&gt;
&lt;line class=&quot;grid&quot; x1=&quot;460&quot; y1=&quot;22&quot; x2=&quot;460&quot; y2=&quot;162&quot;/&gt;
&lt;text class=&quot;t-b&quot; x=&quot;50&quot; y=&quot;45&quot; text-anchor=&quot;end&quot;&gt;8.2&lt;/text&gt;
&lt;rect class=&quot;s1&quot; x=&quot;82.9&quot; y=&quot;30&quot; width=&quot;110.4&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.2: active support from Dec 2022 to Dec 2024&lt;/title&gt;&lt;/rect&gt;
&lt;rect class=&quot;s2&quot; x=&quot;195.3&quot; y=&quot;30&quot; width=&quot;104.7&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.2: security fixes only until Dec 31, 2026&lt;/title&gt;&lt;/rect&gt;
&lt;text class=&quot;t-b&quot; x=&quot;50&quot; y=&quot;80&quot; text-anchor=&quot;end&quot;&gt;8.3&lt;/text&gt;
&lt;rect class=&quot;s1&quot; x=&quot;134.1&quot; y=&quot;65&quot; width=&quot;112.6&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.3: active support from Nov 2023 to Dec 2025&lt;/title&gt;&lt;/rect&gt;
&lt;rect class=&quot;s2&quot; x=&quot;248.7&quot; y=&quot;65&quot; width=&quot;104.6&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.3: security fixes only until Dec 31, 2027&lt;/title&gt;&lt;/rect&gt;
&lt;text class=&quot;t-b&quot; x=&quot;50&quot; y=&quot;115&quot; text-anchor=&quot;end&quot;&gt;8.4&lt;/text&gt;
&lt;rect class=&quot;s1&quot; x=&quot;187.5&quot; y=&quot;100&quot; width=&quot;112.5&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.4: active support from Nov 2024 to Dec 2026&lt;/title&gt;&lt;/rect&gt;
&lt;rect class=&quot;s2&quot; x=&quot;302&quot; y=&quot;100&quot; width=&quot;104.7&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.4: security fixes only until Dec 31, 2028&lt;/title&gt;&lt;/rect&gt;
&lt;text class=&quot;t-b&quot; x=&quot;50&quot; y=&quot;150&quot; text-anchor=&quot;end&quot;&gt;8.5&lt;/text&gt;
&lt;rect class=&quot;s1&quot; x=&quot;240.8&quot; y=&quot;135&quot; width=&quot;112.5&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.5: active support from Nov 2025 to Dec 2027&lt;/title&gt;&lt;/rect&gt;
&lt;rect class=&quot;s2&quot; x=&quot;355.3&quot; y=&quot;135&quot; width=&quot;104.7&quot; height=&quot;22&quot; rx=&quot;3&quot; data-hover&gt;&lt;title&gt;PHP 8.5: security fixes only until Dec 31, 2029&lt;/title&gt;&lt;/rect&gt;
&lt;line class=&quot;crit-line&quot; x1=&quot;290.4&quot; y1=&quot;20&quot; x2=&quot;290.4&quot; y2=&quot;162&quot;/&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;290.4&quot; y=&quot;14&quot; text-anchor=&quot;middle&quot;&gt;today&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;86.7&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2023&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;140&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2024&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;193.3&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2025&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;246.7&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2026&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;300&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2027&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;353.3&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2028&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;406.7&quot; y=&quot;178&quot; text-anchor=&quot;middle&quot;&gt;2029&lt;/text&gt;
&lt;text class=&quot;t-sm&quot; x=&quot;460&quot; y=&quot;178&quot; text-anchor=&quot;end&quot;&gt;2030&lt;/text&gt;
&lt;rect class=&quot;s1&quot; x=&quot;90&quot; y=&quot;194&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;108&quot; y=&quot;205&quot;&gt;Active support&lt;/text&gt;
&lt;rect class=&quot;s2&quot; x=&quot;230&quot; y=&quot;194&quot; width=&quot;12&quot; height=&quot;12&quot; rx=&quot;2&quot;/&gt;
&lt;text class=&quot;t&quot; x=&quot;248&quot; y=&quot;205&quot;&gt;Security fixes only&lt;/text&gt;
&lt;/svg&gt;
&lt;figcaption&gt;Source: php.net/supported-versions. PHP 8.2 reaches end of life on Dec 31, 2026.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;What applies to any team:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;be on a supported branch.&lt;/strong&gt; If you&#039;re still on 8.2, start migrating now;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;make patching cheap.&lt;/strong&gt; Versioned images, automated tests and a simple deploy turn an emergency patch into routine;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;know what runs in production.&lt;/strong&gt; In the middle of an incident, nobody wants to discover a forgotten server running mod_php.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;conclusion&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;PHP2Shell was serious: unauthenticated RCE, a confirmed exploit and government websites offline. And there&#039;s no ignoring that the problem had been known since 2024.&lt;/p&gt;

&lt;p&gt;At the same time, I liked how the Foundation handled it: it owned the mistake publicly, explained what will change and delivered a fix that genuinely changes how PHP deals with running out of memory. That&#039;s the sign of a mature project.&lt;/p&gt;

&lt;p&gt;The lesson is the usual one, but it still holds: &lt;strong&gt;update&lt;/strong&gt;, and set up your environment so that updating is easy next time.&lt;/p&gt;

&lt;p&gt;See you next time, cheers! 🐘&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://thephp.foundation/blog/2026/10/21/todays-php-security-release-and-how-were-strengthening-php-security/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;The PHP Foundation: Today&#039;s PHP security release and how we&#039;re strengthening PHP security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/archive/2026.php#2026-10-21-5&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP.net: Security advisory, critical remote code execution vulnerabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.php.net/archive/2026.php#2026-10-23-1&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP.net: Informational advisory, session upload progress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/php/php-src/commit/3584a98bda0f2c0d367255b046798b0d3a221a19&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;The fix commit in php-src&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://watchtowr.com/intelligence/php-cve-2026-109618-faq/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;watchTowr: PHP2Shell FAQ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.cisa.gov/news-events/alerts/2026/10/21/critical-vulnerabilities-php-require-immediate-patching&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;CISA: Critical vulnerabilities in PHP require immediate patching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://x.com/FBICyberDiv/status/2112921648252719420&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;FBI Cyber Division: alert on the PHP vulnerabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.newsweek.com/fbi-issues-advice-as-security-issue-hits-global-websites-12603155&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Newsweek: FBI issues advice as security issue hits global websites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://g1.globo.com/tecnologia/ciberseguranca/noticia/2026/10/23/brecha-no-php-que-tirou-sites-do-ar-foi-descoberta-ha-dois-anos-responsavel-cita-falta-de-recursos-para-corrigi-la.ghtml&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;g1 (Portuguese): PHP flaw that took sites offline was discovered two years ago&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.akamai.com/blog/security-research/inside-node2shell-closer-look-cve-2026-111497&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Akamai: Inside Node2Shell, a closer look at CVE-2026-111497&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://thehackernews.com/2026/10/brotli-decoder-flaw-behind-nodejs-rce.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;The Hacker News: Brotli decoder flaw behind Node.js RCE also affects Bun, Python and other software&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sansec.io/research/php2shell&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Sansec: PHP2Shell, fixes for end-of-life PHP versions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://projectdiscovery.io/research/php2shell&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;ProjectDiscovery: PHP2Shell, finding and patching affected PHP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/typephp-aot-compiler-for-php-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/typephp-aot-compiler-for-php-en" />
            <title>TypePHP, the compiler that turns PHP into a native binary</title>
            <published>2026-08-27T00:00:00+00:00</published>
            <updated>2026-08-27T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">TypePHP, a project from the Swoole team, compiles PHP to C++ and produces native binaries. See what that changes for PHP developers.</summary>
            <content type="html">&lt;p&gt;Recently, the &lt;a href=&quot;https://github.com/swoole&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Swoole&lt;/a&gt; team open sourced a project that caught my attention: &lt;a href=&quot;https://github.com/swoole/typephp&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;TypePHP&lt;/a&gt;, an &lt;code&gt;AOT&lt;/code&gt; (Ahead-of-Time) compiler for PHP.&lt;/p&gt;

&lt;p&gt;For anyone unfamiliar with the term, &lt;code&gt;AOT&lt;/code&gt; means the code gets compiled before it runs, turning into a ready-made binary, unlike traditional PHP, which interprets the code (or compiles bits of it on the fly, in the case of JIT) on every execution.&lt;/p&gt;

&lt;p&gt;The idea is simple to explain: you write PHP, and it compiles that code into native code, going through C++ along the way. In practice, this lets you generate executables, PHP extensions, and shared libraries.&lt;/p&gt;

&lt;p&gt;And the question that remains is: what does this change for those who already develop in PHP?&lt;/p&gt;

&lt;h2&gt;Contents&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#php-that-becomes-an-executable&quot;&gt;PHP that becomes an executable&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#a-worker-that-keeps-running&quot;&gt;A worker that keeps running&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-about-php-extensions&quot;&gt;What about PHP extensions?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#where-does-this-actually-make-sense&quot;&gt;Where does this actually make sense?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-about-performance&quot;&gt;What about performance?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-it-still-isnt&quot;&gt;What it still isn&#039;t&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#who-is-typephp-interesting-for&quot;&gt;Who is TypePHP interesting for?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#is-it-worth-following&quot;&gt;Is it worth following?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#in-short&quot;&gt;In short&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#final-thoughts&quot;&gt;Final thoughts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;php-that-becomes-an-executable&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;PHP that becomes an executable&lt;/h2&gt;

&lt;p&gt;We&#039;re used to running PHP like this:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;php app.php
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or, in a web application:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HTTP Request
     ↓
   Nginx
     ↓
  PHP-FPM
     ↓
  PHP code
     ↓
 Response
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With TypePHP there&#039;s another possibility:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;PHP
 ↓
TypePHP
 ↓
C++
 ↓
native compiler
 ↓
executable
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php
function calculate(int $n): int
{
    $result = 0;
    for ($i = 0; $i &amp;lt; $n; $i++) {
        $result += $i * $i;
    }
    return $result;
}

echo calculate(1000000);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Instead of distributing the &lt;code&gt;.php&lt;/code&gt; file, the idea is to compile this code into an executable that runs directly with &lt;code&gt;./app&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;TypePHP has its own CLI, &lt;code&gt;tpc&lt;/code&gt;, with different compilation modes: &lt;code&gt;bin&lt;/code&gt;, &lt;code&gt;ext&lt;/code&gt;, and &lt;code&gt;lib&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That opens up a possibility we don&#039;t usually associate with PHP: distributing an application as a native program. Imagine a tool:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mytool backup
mytool migrate
mytool analyze
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Instead of the user having to install PHP, Composer, dependencies, and extensions, you distribute a single executable.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;a-worker-that-keeps-running&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;A worker that keeps running&lt;/h2&gt;

&lt;p&gt;Another possibility is building programs that stay alive continuously. For example, a worker:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;RabbitMQ
    ↓
┌──────────────────────┐
│     my-worker         │
│                       │
│  picks up a job       │
│  processes it         │
│  saves the result     │
│  waits for the next   │
│        ...            │
└──────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Instead of thinking only in terms of PHP scripts run on demand, you get a &lt;code&gt;./my-worker&lt;/code&gt; running around the clock.&lt;/p&gt;

&lt;p&gt;This gets a lot closer to the model we already know from Go, Rust, Node.js, or Java applications.&lt;/p&gt;

&lt;p&gt;Of course, TypePHP doesn&#039;t automatically turn any PHP application into a concurrent server: networking, event loop, concurrency, and communication still depend on the runtime and libraries you use. Even so, being able to generate a persistent native process written in PHP already changes the game quite a bit.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;what-about-php-extensions&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What about PHP extensions?&lt;/h2&gt;

&lt;p&gt;TypePHP can also generate native extensions. For example:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php
function hello(string $name): string
{
    return &quot;Hello, {$name}!&quot;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Compiling in &lt;code&gt;ext&lt;/code&gt; mode:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;tpc hello.php --mode=ext -o hello
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The result is a native extension, &lt;code&gt;hello.so&lt;/code&gt;, loaded like any other PHP extension:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;php -d extension=./hello.so -r &quot;echo hello(&#039;Marcos&#039;);&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That creates a bridge between the PHP world and native code, without having to write the whole implementation in C or C++.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;where-does-this-actually-make-sense&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Where does this actually make sense?&lt;/h2&gt;

&lt;p&gt;I don&#039;t see TypePHP as a way to take an entire Laravel application and turn it into an executable. The scenario that makes the most sense to me is different:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;              PHP Application
                    │
        ┌───────────┴───────────┐
        │                       │
   business logic            heavy
   HTTP / ORM / etc.        processing
                                │
                                ▼
                             TypePHP
                                │
                                ▼
                          native code
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You keep using PHP where it&#039;s excellent, but experiment with compiled code in specific parts, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;processing large volumes of data;&lt;/li&gt;
&lt;li&gt;parsers;&lt;/li&gt;
&lt;li&gt;algorithms and numeric processing;&lt;/li&gt;
&lt;li&gt;workers;&lt;/li&gt;
&lt;li&gt;CLIs;&lt;/li&gt;
&lt;li&gt;agents;&lt;/li&gt;
&lt;li&gt;infrastructure tools;&lt;/li&gt;
&lt;li&gt;components that need to be distributed as binaries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And there&#039;s an extra advantage for commercial software: the customer doesn&#039;t have to receive your original PHP source code. The project itself lists source code protection as one of the advantages of AOT compilation. That doesn&#039;t make a binary impossible to analyze (reverse engineering is still a thing), but it&#039;s quite different from handing over a folder full of &lt;code&gt;.php&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;what-about-performance&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What about performance?&lt;/h2&gt;

&lt;p&gt;It&#039;s the first thing that comes to mind when the subject is native compilation, but I&#039;d temper expectations here.&lt;/p&gt;

&lt;p&gt;That doesn&#039;t mean &lt;em&gt;&quot;Laravel + TypePHP = a 10x faster application&quot;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If your application spends most of its time waiting on MySQL, Redis, or external APIs, compiling the PHP won&#039;t fix that bottleneck. The real potential gain is in code that actually burns CPU:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;for ($i = 0; $i &amp;lt; 100000000; $i++) {
    $result += $i * $i;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;TypePHP also works with native types, like &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt;, and &lt;code&gt;bool&lt;/code&gt;, and typed containers, giving the compiler more information to generate native code.&lt;/p&gt;

&lt;p&gt;I see performance as a real advantage of the project, but not as the main reason to follow it.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;what-it-still-isnt&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;What it still isn&#039;t&lt;/h2&gt;

&lt;p&gt;TypePHP is still under development and works with a defined subset of the PHP language.&lt;/p&gt;

&lt;p&gt;That happens because PHP is extremely dynamic:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$method = $foo;
$object-&amp;gt;$method();
call_user_func($callback);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The more dynamic an application is, the harder it becomes for the compiler to determine ahead of time what that code will actually do. So don&#039;t expect to take any existing PHP project, especially a large one full of dynamic features, and just spit out an executable.&lt;/p&gt;

&lt;p&gt;TypePHP still isn&#039;t &quot;Go written in PHP.&quot; But it might be quite a path toward the future of the language.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;who-is-typephp-interesting-for&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Who is TypePHP interesting for?&lt;/h2&gt;

&lt;p&gt;If you work exclusively with Laravel, Symfony, and traditional APIs, TypePHP might not change much in your day-to-day, at least for now.&lt;/p&gt;

&lt;p&gt;But it starts to make a lot of sense if you build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CLI tools;&lt;/li&gt;
&lt;li&gt;workers and queue consumers;&lt;/li&gt;
&lt;li&gt;file processing;&lt;/li&gt;
&lt;li&gt;parsers;&lt;/li&gt;
&lt;li&gt;infrastructure tools;&lt;/li&gt;
&lt;li&gt;agents that run on the machine;&lt;/li&gt;
&lt;li&gt;commercial software that needs to be distributed;&lt;/li&gt;
&lt;li&gt;PHP extensions;&lt;/li&gt;
&lt;li&gt;CPU-bound code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In those cases, TypePHP stops being a curiosity and becomes one more tool in the box.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;is-it-worth-following&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Is it worth following?&lt;/h2&gt;

&lt;p&gt;I think so. Not because you should ditch PHP-FPM, Laravel, or Symfony tomorrow, but because the project is exploring a possibility that historically wasn&#039;t very common in the PHP ecosystem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;             PHP
              │
       ┌──────┼──────┐
       │      │      │
       ▼      ▼      ▼
      Web   Worker   CLI
       │      │      │
    PHP-FPM  binary  binary
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A PHP developer can keep using all the experience they already have in the language and, in specific scenarios, start producing native software.&lt;/p&gt;

&lt;p&gt;Given my experience with PHP extensions and command-line tools, I already have a few ideas in mind to test TypePHP and build my first native binaries.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;in-short&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;In short&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You keep writing PHP.&lt;/li&gt;
&lt;li&gt;TypePHP compiles it to native code.&lt;/li&gt;
&lt;li&gt;You can generate binaries, extensions, and libraries.&lt;/li&gt;
&lt;li&gt;Typed code can benefit from native optimizations.&lt;/li&gt;
&lt;li&gt;The project is still under development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;final-thoughts&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Final thoughts&lt;/h2&gt;

&lt;p&gt;The core point of TypePHP isn&#039;t making PHP run faster. It&#039;s the possibility of changing the kind of software we can build and distribute using the language.&lt;/p&gt;

&lt;p&gt;Today, when we think of a:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CLI;&lt;/li&gt;
&lt;li&gt;daemon;&lt;/li&gt;
&lt;li&gt;worker;&lt;/li&gt;
&lt;li&gt;agent;&lt;/li&gt;
&lt;li&gt;infrastructure service;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;it&#039;s very common to reach for Go or Rust.&lt;/p&gt;

&lt;p&gt;With a compiler like TypePHP, we start asking a different question: do we still need to switch languages, or can we keep using PHP and compile that part into native code?&lt;/p&gt;

&lt;p&gt;It&#039;s still early to answer that. But, as a PHP developer, that&#039;s exactly why I&#039;ll be keeping an eye on TypePHP.&lt;/p&gt;

&lt;p&gt;The project is open on GitHub: &lt;a href=&quot;https://github.com/swoole/typephp&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;TypePHP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;See you next time, and cheers! 🐘&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-86-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-86-en" />
            <title>Discover the main new features in PHP 8.6</title>
            <published>2026-08-17T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">PHP 8.6 is out with features like Partial Function Application, the new Polling API, the clamp() function, and more secure session defaults, making the language simpler, more expressive, and future-ready. Check out the main highlights in this post.</summary>
            <content type="html">&lt;p&gt;PHP 8.6 was officially released on November 19, 2026.&lt;/p&gt;

&lt;p&gt;In this post, I bring a summary of the main improvements in 8.6, based on the &lt;a href=&quot;https://www.php.net/releases/8.6/?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;official announcement&lt;/a&gt; and the
accepted RFCs. I picked out
what makes the biggest difference day-to-day, since a lot is developed throughout the year to make the language
simpler, faster, and more consistent.&lt;/p&gt;

&lt;h2&gt;Contents&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#polling-api&quot;&gt;Polling API: a native foundation for async I/O&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#partial-function-application&quot;&gt;Partial Function Application: filling in arguments ahead of time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#clamp&quot;&gt;The &lt;code&gt;clamp()&lt;/code&gt; function: restricting values to a range&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#secure-session-defaults&quot;&gt;More secure session defaults&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#stream-error-handling&quot;&gt;Stream error handling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#additional-features-and-improvements&quot;&gt;Additional features and improvements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#deprecations-and-backwards-compatibility-breaks&quot;&gt;Deprecations and backwards-compatibility breaks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#final-thoughts&quot;&gt;Final thoughts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;polling-api&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Polling API: a native foundation for async I/O&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/poll_api?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PHP 8.6 brings the new &lt;code&gt;Io\Poll&lt;/code&gt; namespace, with a native polling API for I/O multiplexing, promising better
performance than the traditional &lt;code&gt;stream_select()&lt;/code&gt;. The idea is to offer a common foundation that low-level
libraries, such as ReactPHP and Amp, can use to manage multiple streams, sockets, and other pollable resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.5 and earlier:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$read = [$server];
$write = $except = [];

stream_select($read, $write, $except, 1);

foreach ($read as $stream) {
    // handle the read event
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.6:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;use Io\Poll\{Context, Event};

$server = stream_socket_server(&#039;tcp://0.0.0.0:8080&#039;);
stream_set_blocking($server, false);

$poll = new Context();
$poll-&amp;gt;add(new StreamPollHandle($server), [Event::Read], [&#039;type&#039; =&amp;gt; &#039;server&#039;]);

while (true) {
    foreach ($poll-&amp;gt;wait(timeoutSeconds: 1) as $watcher) {
        if ($watcher-&amp;gt;getData()[&#039;type&#039;] === &#039;server&#039; &amp;amp;&amp;amp; $watcher-&amp;gt;hasTriggered(Event::Read)) {
            $client = stream_socket_accept($server);
            $poll-&amp;gt;add(new StreamPollHandle($client), [Event::Read], [&#039;type&#039; =&amp;gt; &#039;client&#039;]);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For now, PHP 8.6 ships the foundation of the API. More specific handles, such as &lt;code&gt;SocketPollHandle&lt;/code&gt;,
&lt;code&gt;CurlPollHandle&lt;/code&gt;, &lt;code&gt;TimerHandle&lt;/code&gt;, and &lt;code&gt;SignalHandle&lt;/code&gt;, are left for future versions.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;partial-function-application&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Partial Function Application: filling in arguments ahead of time&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/partial_function_application_v2?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;main RFC&lt;/a&gt; · &lt;a href=&quot;https://wiki.php.net/rfc/partial_function_application_optional_placeholder?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;companion RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PHP 8.6 introduces partial function application, allowing you to create closures from a function call by filling in
some arguments and leaving others for later. This is done with the &lt;code&gt;?&lt;/code&gt; (single argument) and &lt;code&gt;...&lt;/code&gt; (remaining
arguments, variadic-style) placeholders. A companion RFC made the behavior more predictable: every &lt;code&gt;?&lt;/code&gt; placeholder
now always generates a required parameter in the resulting closure.&lt;/p&gt;

&lt;p&gt;This feature is a natural extension of the first-class callable syntax added in PHP 8.1, and it pairs really well
with the pipe operator introduced in PHP 8.5.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.5 and earlier:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;function convertCurrency(float $amount, string $from, string $to): float { /* ... */ }

$toBRL = fn (float $amount, string $from): float =&amp;gt; convertCurrency($amount, $from, &#039;BRL&#039;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.6:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;function convertCurrency(float $amount, string $from, string $to): float { /* ... */ }

$toBRL = convertCurrency(?, ?, &#039;BRL&#039;);
$toBRL(100.0, &#039;USD&#039;);
// Equivalent to: fn(float $amount, string $from): float =&amp;gt; convertCurrency($amount, $from, &#039;BRL&#039;);

$prices = [19.90, 249.00, 5.50];
$pricesInBRL = array_map(convertCurrency(?, &#039;USD&#039;, &#039;BRL&#039;), $prices);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Worth noting that constructors aren&#039;t supported: you can&#039;t create a partial closure from a &lt;code&gt;new&lt;/code&gt; expression. The
reason, according to the RFC itself, is that constructors are invoked indirectly by the engine, which would make
supporting them notably more work, and the use cases for it are rare, especially now that PHP 8.4 has lazy objects.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;clamp&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The &lt;code&gt;clamp()&lt;/code&gt; function: restricting values to a range&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/clamp_v2?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PHP 8.6 gets the native &lt;code&gt;clamp()&lt;/code&gt; function, which restricts a value to a minimum and maximum range. If the value is
outside the range, it returns the nearest bound; otherwise, it returns the value itself. It&#039;s such a common case
that it always ended up as some combination of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; scattered across the codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.5 and earlier:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$zoom = max(50, min(200, $zoom));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.6:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$zoom = clamp($zoom, min: 50, max: 200);

clamp(30, min: 50, max: 200); // 50
clamp(120, min: 50, max: 200); // 120
clamp(250, min: 50, max: 200); // 200
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a id=&quot;secure-session-defaults&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;More secure session defaults&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/session_security_defaults?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Three &lt;code&gt;ext/session&lt;/code&gt; directives had security implications, but shipped with default values that left applications
unnecessarily exposed. PHP 8.6 changes these defaults so new installs are more secure out of the box, with no code
changes needed for the common case.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;session.use_strict_mode&lt;/code&gt;: from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt;, mitigating session fixation attacks.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;session.cookie_httponly&lt;/code&gt;: from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt;, making it harder to access the session cookie via XSS.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;session.cookie_samesite&lt;/code&gt;: from empty to &lt;code&gt;Lax&lt;/code&gt;, mitigating CSRF attacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;stream-error-handling&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Stream error handling&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/stream_errors?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Error handling for streams has always been a bit inconsistent in PHP: each wrapper reports failures its own way
(a warning, a notice, or just a plain &lt;code&gt;false&lt;/code&gt; with no context), which makes it hard to know exactly what went wrong.
PHP 8.6 adds a structured, opt-in system for this, with the new &lt;code&gt;StreamErrorMode&lt;/code&gt; enum and the &lt;code&gt;StreamError&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.5 and earlier:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$stream = @fopen(&#039;file.txt&#039;, &#039;r&#039;);

if ($stream === false) {
    // no structured information about why it failed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;PHP 8.6:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$context = stream_context_create([
    &#039;stream&#039; =&amp;gt; [&#039;error_mode&#039; =&amp;gt; StreamErrorMode::Exception],
]);

try {
    $stream = fopen(&#039;file.txt&#039;, &#039;r&#039;, context: $context);
} catch (StreamException $e) {
    $error = $e-&amp;gt;getErrors()[0];
    echo $error-&amp;gt;code-&amp;gt;name; // e.g., &quot;NotFound&quot;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The default behavior stays the same as today (&lt;code&gt;StreamErrorMode::Error&lt;/code&gt;), so nothing changes for code that doesn&#039;t
opt into the new mode. PHP 8.6 also adds the &lt;code&gt;stream_last_errors()&lt;/code&gt; and &lt;code&gt;stream_clear_errors()&lt;/code&gt; functions, to
inspect and clear stored errors outside of a &lt;code&gt;try&lt;/code&gt;/&lt;code&gt;catch&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;&lt;a id=&quot;additional-features-and-improvements&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Additional features and improvements&lt;/h2&gt;

&lt;p&gt;Besides the main features in PHP 8.6, several smaller improvements were added to make development safer, more
consistent, and more predictable.&lt;/p&gt;

&lt;h3&gt;Default values for &lt;code&gt;readonly&lt;/code&gt; properties&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/readonly_property_defaults?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;readonly&lt;/code&gt; properties can now have a default value, which is especially useful combined with the interface
properties introduced in PHP 8.4, letting you declare fixed metadata without needing a constructor:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;final readonly class InvoiceExporter implements ExporterBlueprint
{
    public string $name = &#039;Invoice Exporter&#039;;
    public string $format = &#039;pdf&#039;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;New &lt;code&gt;Time\Duration&lt;/code&gt; class&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/duration_class?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Class that represents a fixed, context-free time span (unlike &lt;code&gt;DateInterval&lt;/code&gt;), useful for timeouts, delays, and
measurements. It ships with methods like &lt;code&gt;Duration::fromSeconds()&lt;/code&gt;, &lt;code&gt;add()&lt;/code&gt;, and &lt;code&gt;divideBy()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;&lt;code&gt;#[\Override]&lt;/code&gt; now also for class constants and enum cases&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/override_constants?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;#[\Override]&lt;/code&gt; attribute, which already worked on methods and properties, can now also be used on class
constants and enum cases, helping guarantee that a constant is really overriding one from the parent class or an
interface.&lt;/p&gt;

&lt;h3&gt;Writing to properties of objects referenced by constants&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/const_object_property_write?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It&#039;s now possible to change properties of an object held in a class constant, while keeping the constant itself
immutable (that is, the reference to the object can&#039;t be swapped, only its internal state):&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;const BACKING = new stdClass();

class C
{
    const O = BACKING;
}

C::O-&amp;gt;prop = 42;
var_dump(C::O-&amp;gt;prop);
// int(42)
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;More expressive enums: &lt;code&gt;SortDirection&lt;/code&gt; and custom debug output&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://wiki.php.net/rfc/sort_direction_enum?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt; · &lt;a href=&quot;https://wiki.php.net/rfc/debugable-enums?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;RFC&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PHP 8.6 brings a native &lt;code&gt;SortDirection&lt;/code&gt; enum, with the cases &lt;code&gt;Ascending&lt;/code&gt; and &lt;code&gt;Descending&lt;/code&gt;, meant for frameworks and
libraries to use instead of loose strings when sorting data:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$query-&amp;gt;orderBy(&#039;created_at&#039;, SortDirection::Descending);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Enums can also now implement &lt;code&gt;__debugInfo()&lt;/code&gt;, just like regular classes, customizing the output of &lt;code&gt;var_dump()&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;enum OrderStatus: string
{
    case Paid = &#039;paid&#039;;

    public function __debugInfo(): array
    {
        return [self::class . &#039;::&#039; . $this-&amp;gt;name =&amp;gt; $this-&amp;gt;value];
    }
}

var_dump(OrderStatus::Paid);
// enum(OrderStatus::Paid) (1) {
//   [&quot;OrderStatus::Paid&quot;]=&amp;gt;
//   string(4) &quot;paid&quot;
// }
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;code&gt;json_decode()&lt;/code&gt; errors with an exact location&lt;/h3&gt;

&lt;p&gt;Syntax errors in &lt;code&gt;json_decode()&lt;/code&gt; now point to the exact line and position (line:column) where the problem
occurred, both in the message returned by &lt;code&gt;json_last_error_msg()&lt;/code&gt; and in the exception thrown with
&lt;code&gt;JSON_THROW_ON_ERROR&lt;/code&gt;. Previously, the message only described the type of error, without pointing to where it
was in the JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;json_decode(&#039;[{&#039;);
json_last_error_msg();
// PHP 8.5 and earlier: &quot;Syntax error&quot;
// PHP 8.6: &quot;Syntax error near location 1:3&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This makes it a lot easier to debug malformed API payloads, webhooks, or configuration files.&lt;/p&gt;

&lt;h3&gt;New in Reflection, enums, and functions&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;New &lt;code&gt;ReflectionProperty::isReadable()&lt;/code&gt; and &lt;code&gt;isWritable()&lt;/code&gt; methods, to check property accessibility.&lt;/li&gt;
&lt;li&gt;Doc comments can now be applied directly to function parameters, and read with the new
&lt;code&gt;ReflectionParameter::getDocComment()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The new &lt;code&gt;error_include_args&lt;/code&gt; INI setting makes error messages display the arguments received in the call, not
just the expected types, making debugging a lot easier.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pack()&lt;/code&gt; and &lt;code&gt;unpack()&lt;/code&gt; now accept the &lt;code&gt;&amp;lt;&lt;/code&gt; and &lt;code&gt;&amp;gt;&lt;/code&gt; endianness modifiers on integer (&lt;code&gt;s&lt;/code&gt;, &lt;code&gt;S&lt;/code&gt;, &lt;code&gt;l&lt;/code&gt;, &lt;code&gt;L&lt;/code&gt;, &lt;code&gt;q&lt;/code&gt;, &lt;code&gt;Q&lt;/code&gt;)
and floating-point (&lt;code&gt;f&lt;/code&gt; and &lt;code&gt;d&lt;/code&gt;) format codes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ext/uri&lt;/code&gt;, introduced in PHP 8.4, gets follow-up improvements: a &lt;code&gt;UriBuilder&lt;/code&gt; for building URIs without
intermediate instances, URI and host type detection, and context-aware percent-encoding functions.&lt;/li&gt;
&lt;li&gt;The Sodium extension adds post-quantum key encapsulation (X-Wing and ML-KEM-768), IP address encryption, and the
SHAKE and TurboSHAKE functions.&lt;/li&gt;
&lt;li&gt;TLS streams now support session resumption, external pre-shared keys (PSK), and TLS 1.3 early data (0-RTT).&lt;/li&gt;
&lt;li&gt;Other small additions: new locale methods on &lt;code&gt;Locale&lt;/code&gt;, &lt;code&gt;grapheme_strrev()&lt;/code&gt;, and &lt;code&gt;mysqli::quote_string()&lt;/code&gt;, which
escapes the string and wraps it in quotes, just like &lt;code&gt;PDO::quote()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Performance improvements&lt;/h3&gt;

&lt;p&gt;With no code changes required, PHP 8.6 brings a few internal optimizations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;array_map()&lt;/code&gt; calls with first-class callables or partial application as the callback are compiled into loops.&lt;/li&gt;
&lt;li&gt;The engine reuses stateless closures (like simple arrow functions) across calls, reducing allocations.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;printf()&lt;/code&gt; calls and JSON encoding are faster.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;deprecations-and-backwards-compatibility-breaks&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Deprecations and backwards-compatibility breaks&lt;/h2&gt;

&lt;h3&gt;Syntax and reserved words&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using &lt;code&gt;return&lt;/code&gt; inside a &lt;code&gt;finally&lt;/code&gt; block has been deprecated, since it silently discards exceptions and overrides
the value returned from the &lt;code&gt;try&lt;/code&gt; or &lt;code&gt;catch&lt;/code&gt; block.&lt;/li&gt;
&lt;li&gt;Returning a value from &lt;code&gt;__construct()&lt;/code&gt; or &lt;code&gt;__destruct()&lt;/code&gt; has also been deprecated.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;let&lt;/code&gt; and &lt;code&gt;is&lt;/code&gt; (as a class, function, or constant name), &lt;code&gt;_&lt;/code&gt; (as a constant name), &lt;code&gt;namespace&lt;/code&gt; (as a class
constant), and &lt;code&gt;readonly&lt;/code&gt; (as a function name) are now deprecated as identifiers, reserved for future language
features such as pattern matching and block scoping.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Form feed is now whitespace in &lt;code&gt;trim()&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;trim()&lt;/code&gt;, &lt;code&gt;ltrim()&lt;/code&gt;, and &lt;code&gt;rtrim()&lt;/code&gt; functions now also strip the form feed character (&lt;code&gt;\f&lt;/code&gt;, ASCII 12) by default,
alongside space, tab, newline, carriage return, and NUL. This is a backwards-compatibility break: code that relied
on preserving this character at the edges of a string needs to be reviewed.&lt;/p&gt;

&lt;h3&gt;Failures that used to go unnoticed&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fclose()&lt;/code&gt;, &lt;code&gt;file_put_contents()&lt;/code&gt;, and &lt;code&gt;copy()&lt;/code&gt; now return &lt;code&gt;false&lt;/code&gt; when flushing or closing the stream fails,
instead of silently ignoring the failure.&lt;/li&gt;
&lt;li&gt;Many functions now throw a &lt;code&gt;ValueError&lt;/code&gt; for out-of-range values, invalid flags, or strings containing NUL bytes,
instead of silently truncating or ignoring them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Objects passed to functions that expect arrays&lt;/h3&gt;

&lt;p&gt;Passing objects to functions that expect an array, such as &lt;code&gt;array_walk()&lt;/code&gt;, &lt;code&gt;array_walk_recursive()&lt;/code&gt;,
&lt;code&gt;deflate_init()&lt;/code&gt;, &lt;code&gt;inflate_init()&lt;/code&gt;, the zlib and bzip2 stream filters, &lt;code&gt;mb_convert_variables()&lt;/code&gt;, and
&lt;code&gt;http_build_query()&lt;/code&gt;, is now deprecated. Use &lt;code&gt;get_object_vars()&lt;/code&gt; to convert the object before passing it in.&lt;/p&gt;

&lt;h3&gt;Deprecated functions and methods&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is_double()&lt;/code&gt;, &lt;code&gt;is_integer()&lt;/code&gt;, and &lt;code&gt;is_long()&lt;/code&gt; (aliases for &lt;code&gt;is_float()&lt;/code&gt; and &lt;code&gt;is_int()&lt;/code&gt;), plus &lt;code&gt;doubleval()&lt;/code&gt;
(an alias for &lt;code&gt;floatval()&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;strcoll()&lt;/code&gt; and the &lt;code&gt;SORT_LOCALE_STRING&lt;/code&gt; flag, tied to locale-sensitive string comparison.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;metaphone()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;$case_insensitive&lt;/code&gt; parameter of &lt;code&gt;define()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Passing a string to &lt;code&gt;is_a()&lt;/code&gt; and &lt;code&gt;is_subclass_of()&lt;/code&gt; when the &lt;code&gt;$allow_string&lt;/code&gt; parameter is &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Several &lt;code&gt;Reflection&lt;/code&gt; and SPL methods, such as &lt;code&gt;ReflectionProperty::setValue()&lt;/code&gt;/&lt;code&gt;setRawValue()&lt;/code&gt; with incorrect
types, &lt;code&gt;ReflectionMethod::invoke()&lt;/code&gt;/&lt;code&gt;invokeArgs()&lt;/code&gt; with objects for static methods, &lt;code&gt;ArrayIterator&lt;/code&gt; methods
inherited from &lt;code&gt;ArrayObject&lt;/code&gt;, &lt;code&gt;spl_classes()&lt;/code&gt;, &lt;code&gt;spl_object_hash()&lt;/code&gt;, and the CSV methods on &lt;code&gt;SplFileObject&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mysqli_stmt_init()&lt;/code&gt;, &lt;code&gt;mysqli_get_charset()&lt;/code&gt;, and using &lt;code&gt;session_set_save_handler()&lt;/code&gt; without the &lt;code&gt;create_sid()&lt;/code&gt;
and &lt;code&gt;validateId()&lt;/code&gt; methods.&lt;/li&gt;
&lt;li&gt;The mbstring regular expression functions (&lt;code&gt;mb_ereg()&lt;/code&gt;, &lt;code&gt;mb_split()&lt;/code&gt;, and friends), since the underlying Oniguruma
library is no longer maintained. They will be removed in PHP 9.0 and should be replaced with PCRE (&lt;code&gt;preg_*&lt;/code&gt; with
the &lt;code&gt;u&lt;/code&gt; modifier).&lt;/li&gt;
&lt;li&gt;Using more than 16 filters in a &lt;code&gt;php://filter&lt;/code&gt; URL without setting the &lt;code&gt;filter.max_filter_count&lt;/code&gt; context option.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a id=&quot;final-thoughts&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Final thoughts&lt;/h2&gt;

&lt;p&gt;In my view, &lt;strong&gt;PHP 8.6&lt;/strong&gt; reinforces just how consistently the language keeps evolving. The new features are useful
in day-to-day work, solve real problems, and make code clearer and more modern.&lt;/p&gt;

&lt;p&gt;For the full list of new features and backwards-compatibility breaks, check out the
&lt;a href=&quot;https://www.php.net/manual/en/migration86.php?utm_source=blog&amp;utm_medium=post&amp;utm_campaign=php86&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;PHP 8.6 migration guide&lt;/a&gt; in the official manual.&lt;/p&gt;

&lt;p&gt;Until next time!&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/how-php-velho-oeste-2026-went-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/how-php-velho-oeste-2026-went-en" />
            <title>How PHP Velho Oeste 2026 went</title>
            <published>2026-08-04T00:00:00+00:00</published>
            <updated>2026-08-04T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">In its fourth edition, PHP Velho Oeste welcomed 249 attendees in Chapecó for two days of learning and networking. More than the number, what stands out is how many people keep coming back year after year, proof that the PHP community is alive and growing.</summary>
            <content type="html">&lt;p&gt;A bit late here, but... on May 29th and 30th, Chapecó hosted the fourth edition of &lt;strong&gt;PHP Velho Oeste&lt;/strong&gt;, and as an organizer and resident of the city that hosts the event, I carry the same feeling I always do: watching something that started small turn into a gathering people make a point of not missing.&lt;/p&gt;

&lt;p&gt;There&#039;s a part I really like that doesn&#039;t show up in any official photo: after the event wraps up, we sit down at a bar for a beer with several attendees, a lot of people actually. No badges, no organizing rush, just conversation. Someone talking about what they learned in a talk, another one talking about work, laughing over some hiccup only the team knows about. This year we even had karaoke, and people did great. To me, that&#039;s as much a part of the event&#039;s success as any talk on stage. In the end, what stays are the stronger bonds and the memories kept in photos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There were 249 attendees&lt;/strong&gt; in this edition.&lt;/p&gt;

&lt;p&gt;What strikes me most isn&#039;t really the number, even though it matters, a lot. It&#039;s noticing how many people come back: people who were there since the very first edition, in 2023, still showing up year after year, alongside new faces discovering the event now. That says a lot about what we&#039;re building: it&#039;s not just an event, it&#039;s a place people choose to return to.&lt;/p&gt;

&lt;p&gt;Our purpose has stayed the same since the beginning: strengthen the PHP community in western Santa Catarina and raise the quality of the event with every edition. It&#039;s a non-profit initiative, everything we raise goes right back into the event itself, and none of it would exist without everyone who was there: attendees, speakers, sponsors, supporters, and the team behind the scenes.&lt;/p&gt;

&lt;p&gt;Learn more about how it went on the event&#039;s &lt;a href=&quot;https://phpvelhoeste.com.br/2026/?utm_source=site&amp;utm_medium=linkedin&amp;utm_campaign=marcosmarcolin&amp;utm_id=2026&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2026/1.jpg&quot; alt=&quot;PHP Velho Oeste 2026&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2026/2.jpg&quot; alt=&quot;PHP Velho Oeste 2026&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2026/3.jpg&quot; alt=&quot;PHP Velho Oeste 2026&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2026/4.jpg&quot; alt=&quot;PHP Velho Oeste 2026&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2026/5.jpg&quot; alt=&quot;PHP Velho Oeste 2026&quot; /&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-100-million-row-challenge-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-100-million-row-challenge-en" />
            <title>🌪️ The 100-million-row challenge in PHP - How to take part</title>
            <published>2026-03-02T00:00:00+00:00</published>
            <updated>2026-03-02T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">A PHP performance challenge that involves processing 100 million rows and generating a final JSON. I decided to take part and explore the problem.</summary>
            <content type="html">&lt;p&gt;&lt;strong&gt;How would you process 100 million rows from a CSV file in the shortest time possible?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I recently found out, through LinkedIn, about an interesting challenge for anyone who enjoys exploring performance,
efficiency, and code optimizations.&lt;/p&gt;

&lt;p&gt;It&#039;s the &lt;strong&gt;100-million-row challenge in PHP&lt;/strong&gt;, a challenge inspired by similar initiatives in other languages,
but adapted for the PHP ecosystem.&lt;/p&gt;

&lt;p&gt;🔗 The official challenge repository is available
at: &lt;a href=&quot;https://github.com/tempestphp/100-million-row-challenge&quot; target=&quot;_blank&quot;&gt;
tempestphp/100-million-row-challenge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I decided to take part to explore the problem, study different efficiency approaches, and also contribute to the
community.&lt;/p&gt;

&lt;p&gt;If you like this kind of problem, consider this an invitation to join in and test your own ideas too. At some point
in their career, every developer ends up needing to &lt;strong&gt;read, process, and transform large volumes of data&lt;/strong&gt;, and in
those scenarios every implementation detail can make a difference in the final performance.&lt;/p&gt;

&lt;p&gt;On top of that, it&#039;s a challenge that mixes &lt;strong&gt;learning, competition, and fun&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;The challenge&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;💡 The challenge was inspired by the Java community&#039;s &lt;strong&gt;1 Billion Row Challenge&lt;/strong&gt;, but adapted for the PHP ecosystem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The idea is simple: read a file with 100 million rows, process that information, and generate a final JSON
with the aggregated data.&lt;/p&gt;

&lt;p&gt;Each row in the file contains a &lt;em&gt;full URL&lt;/em&gt; and a &lt;em&gt;timestamp&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The solution must extract the &lt;strong&gt;URL path&lt;/strong&gt;, group the hits &lt;strong&gt;by day&lt;/strong&gt;, and produce a JSON in the following format:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;/blog/11-million-rows-in-seconds&quot;: {
    &quot;2025-01-24&quot;: 1,
    &quot;2026-01-24&quot;: 2
  },
  &quot;/blog/php-enums&quot;: {
    &quot;2024-01-24&quot;: 1
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In other words, each page holds a map with the number of hits per date.&lt;/p&gt;

&lt;h2&gt;Important rules&lt;/h2&gt;

&lt;p&gt;The challenge has some interesting restrictions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The solution must be written in PHP only&lt;/li&gt;
&lt;li&gt;External tools are not allowed&lt;/li&gt;
&lt;li&gt;The script must run entirely within the project&lt;/li&gt;
&lt;li&gt;FFI is not allowed&lt;/li&gt;
&lt;li&gt;JIT is disabled by default&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These restrictions make the challenge more interesting, since they force you to focus on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;file-reading efficiency&lt;/li&gt;
&lt;li&gt;memory usage&lt;/li&gt;
&lt;li&gt;efficient string handling&lt;/li&gt;
&lt;li&gt;data structures&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Getting started&lt;/h3&gt;

&lt;p&gt;To take part, just fork the repository and run the local environment.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;# Install dependencies
composer install

# Generate a development dataset (1_000_000 is the default)
php tempest data:generate

# Generate a larger dataset
php tempest data:generate 50_000_000
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The real benchmark uses &lt;strong&gt;100 million rows&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After that, just implement your solution in the class:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;final class Parser
{
    public function parse(string $inputPath, string $outputPath): void
    {
        throw new Exception(&#039;TODO&#039;);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;While developing, you can run the parser with:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;php tempest data:parse
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And validate the result with:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;php tempest data:validate
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If validation passes, your implementation is correct.&lt;/p&gt;

&lt;h2&gt;Running the challenge with Docker (optional)&lt;/h2&gt;

&lt;p&gt;To standardize the environment and make it easier to run the challenge, I used a simple container with PHP 8.5.&lt;/p&gt;

&lt;h4&gt;Dockerfile&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&quot;language-dockerfile&quot;&gt;FROM php:8.5-cli-alpine

WORKDIR /app

RUN apk add --no-cache \
        git \
        icu-dev \
        $PHPIZE_DEPS \
    &amp;amp;&amp;amp; docker-php-ext-install intl \
    &amp;amp;&amp;amp; docker-php-ext-install pcntl \
    &amp;amp;&amp;amp; apk del --no-network $PHPIZE_DEPS \
    &amp;amp;&amp;amp; git config --global --add safe.directory /app \
    &amp;amp;&amp;amp; { \
        echo &quot;opcache.enable_cli=1&quot;; \
        echo &quot;opcache.jit=0&quot;; \
        echo &quot;opcache.jit_buffer_size=0&quot;; \
    } &amp;gt; /usr/local/etc/php/conf.d/99-disable-jit.ini

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

ENV COMPOSER_ALLOW_SUPERUSER=1
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;docker-compose.yml&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&quot;language-yaml&quot;&gt;services:
  app:
    build: .
    working_dir: /app
    volumes:
      - ./:/app
    tty: true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Installing dependencies and running commands:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;docker compose run --rm app composer install
docker compose run --rm app php tempest data:generate
docker compose run --rm app php tempest data:parse
docker compose run --rm app php tempest data:validate
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Submitting your solution&lt;/h3&gt;

&lt;p&gt;Submission is done through a Pull Request on the repository. The PR title must be your GitHub &lt;em&gt;username&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;After manual validation, the organizers run the benchmark on an official server and record the time on the leaderboard.&lt;/p&gt;

&lt;p&gt;You can also request a new run by commenting &lt;code&gt;/bench&lt;/code&gt; on the PR.&lt;/p&gt;

&lt;h3&gt;Categories and ranking&lt;/h3&gt;

&lt;p&gt;The challenge has two main categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;multi-process&lt;/strong&gt;, where the solution can use multiple processes (for example with &lt;code&gt;pcntl&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;single-thread&lt;/strong&gt;, where the solution must run using only a single process&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;em&gt;single-thread&lt;/em&gt; category is particularly interesting, since it lets you compare algorithm efficiency without
relying on multiple processes.&lt;/p&gt;

&lt;p&gt;During the challenge, I also contributed by building a ranking site to make it easier to visualize the results and
the submitted
solutions: &lt;a href=&quot;https://marcosmarcolin.github.io/leaderboard-100-million-row-challenge/&quot; target=&quot;_blank&quot;&gt;PHP 100M
Row Challenge Explorer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The idea was to make it easier to follow the evolution of submissions and explore the community&#039;s different
implementations.&lt;/p&gt;

&lt;p&gt;Later on, that ranking ended up being &lt;strong&gt;referenced directly in the challenge&#039;s official repository&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;Prizes&lt;/h3&gt;

&lt;p&gt;Winners receive prizes sponsored by JetBrains and Tideways, including PhpStorm and Tideways ElePHPants,
JetBrains All Products licenses, and access to Tideways Team.&lt;/p&gt;

&lt;p&gt;The challenge is open until March 15, 2026.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;This kind of challenge is interesting because it involves processing a considerable amount of data. Situations like
this demand attention to several technical aspects, such as I/O efficiency, memory usage, and strategies for handling
large-scale processing.&lt;/p&gt;

&lt;p&gt;I decided to take part mainly as a technical exercise and also to explore different approaches to the problem.&lt;/p&gt;

&lt;p&gt;During the process, I actually ended up using the &lt;strong&gt;pcntl&lt;/strong&gt; extension in practice, something I already knew about but
hadn&#039;t yet applied for real in a project. It was a great opportunity to experiment with that kind of approach and
realize how much using multiple processes can widen the range of possible solutions.&lt;/p&gt;

&lt;p&gt;In the end, it&#039;s a challenge that demands a lot of attention to detail and a solid knowledge of the language,
especially because every millisecond can make a difference in the final result.&lt;/p&gt;

&lt;p&gt;Thanks for reading this far. See you in the next one!&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/blog/php-30-years-larry-garfield-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/blog/php-30-years-larry-garfield-en" />
            <title>🐘 PHP 30 Years - A Conversation with Larry Garfield</title>
            <published>2026-02-18T00:00:00+00:00</published>
            <updated>2026-02-18T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">Interview from the PHP 30 Years series with Larry Garfield.</summary>
            <content type="html">&lt;p&gt;This interview is part of the &lt;strong&gt;PHP 30 Years – Contributor Interview&lt;/strong&gt; series, created to celebrate three decades of the
language and highlight the people who have helped, and continue to help, shape the PHP ecosystem.&lt;/p&gt;

&lt;p&gt;Larry Garfield is one of the most respected voices in the modern PHP ecosystem.
A long-time Drupal contributor, he led the Drupal 8 &lt;em&gt;Web Services&lt;/em&gt; initiative, which helped transform Drupal into a modern
PHP platform.
He has served as &lt;em&gt;Principal Engineer&lt;/em&gt; at MakersHub, &lt;em&gt;Staff Engineer&lt;/em&gt; at TYPO3 and LegalZoom, and &lt;em&gt;Director of Developer
Experience&lt;/em&gt; at Platform.sh(now Upsun).&lt;/p&gt;

&lt;p&gt;Larry is a member of the PHP-FIG &lt;em&gt;Core Committee&lt;/em&gt; and has co-authored several important PHP RFCs, including proposals
around &lt;strong&gt;Enums&lt;/strong&gt;, &lt;strong&gt;Property Hooks&lt;/strong&gt;, and the &lt;strong&gt;Pipe Operator&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;He is also the author of multiple books on PHP, including &lt;em&gt;&lt;a href=&quot;https://leanpub.com/thinking-functionally-in-php&quot;&gt;Thinking Functionally in PHP&lt;/a&gt;&lt;/em&gt; and &lt;em&gt;&lt;a href=&quot;https://leanpub.com/exploringphp80&quot;&gt;Exploring PHP 8.0&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Below is the full interview.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;Was there a mentor, person, or reference who influenced your journey with PHP?&lt;/h3&gt;

&lt;p&gt;I have not had a specific active mentor, but I have certainly been influenced by many people over the years, directly and
indirectly.&lt;/p&gt;

&lt;p&gt;Fabien Potencier of Symfony fame stands out as someone that I learned a lot from, even if not directly.&lt;/p&gt;

&lt;p&gt;My RFC collaborator Ilija Tovilo has been highly educational as well.&lt;/p&gt;

&lt;h3&gt;How did your journey with PHP begin, and what motivated you to keep contributing actively to the language?&lt;/h3&gt;

&lt;p&gt;I first came across PHP 3 back in 1999, in college, at the recommendation of a friend. I found it more approachable than
a lot of other things and, as I was already interested in web development, I dove in. I eventually started doing
freelance consulting for local politicians, which is how I went through my &quot;every PHP dev invents their own CMS and then
abandons it&quot; phase. I am pleased to say none of my code from those days still exists.&lt;/p&gt;

&lt;p&gt;After grad school and a brief detour into tech journalism, I landed a job at a small local agency that used PHP, although,
in hindsight, not very well. Around that time (2005), I also got involved in Drupal, initially because I was looking for
a project to learn from so I could build a new BBS for my online Star Trek RPG club. (Yes, I&#039;m a nerd.) I ended up using
Drupal for it, and also got pulled into Drupal itself. It was the first &lt;em&gt;Open Source&lt;/em&gt; project I ever contributed to, and,
over the next decade, I became one of the lead developers. Over time, due in part (but not exclusively) to my
involvement, that agency grew into one of the leading Drupal consultancies in the world.&lt;/p&gt;

&lt;p&gt;In 2007, at DrupalCon Sunnyvale, Rasmus Lerdorf begged the Drupal community to drop PHP 4 support and focus on PHP 5,
something few projects were doing out of fear they&#039;d lose market share, since most web hosts (it seemed) did not offer
PHP 5 support. Jonah Braun, from Joomla, suggested to another Drupal colleague of mine, during a picnic, that projects
should coordinate moving to PHP 5 at the same time. That colleague mentioned it in a blog comment, I read it, and so
began the GoPHP5 campaign: coordinating many projects and hosts committing to PHP 5.2 support all at once (at the time,
the latest release).&lt;/p&gt;

&lt;p&gt;We launched on January 5, 2007, with 6 projects and 3 hosts signed on to only support PHP 5.2 in our next releases. A
month later, we had over 100 projects and 200 hosts signed on, and the PHP Internals team had decided to drop support
for PHP 4 as well. We successfully assassinated a language (PHP 4) and, I believe, saved PHP.&lt;/p&gt;

&lt;p&gt;I then went on to write the new DBAL for Drupal 7, which is still used to this day. For Drupal 8, I led the effort to
modernize the codebase, integrate Symfony components, and otherwise overhaul the entire system. This was against the
backdrop of the &quot;PHP Renaissance&quot; of PHP 5.3–5.6. Dozens of people, from dozens of projects, spent thousands of hours
working to break down walls between PHP projects and create a more integrated, broader PHP community. &lt;em&gt;Composer/Packagist&lt;/em&gt;
was instrumental in that, as was what became the PHP-FIG. While I was not a founding member of the PHP-FIG, I quickly got
involved and became a long-time leader in that effort. (I still sit on the PHP-FIG &lt;em&gt;Core Committee&lt;/em&gt;, having co-authored
most of the current bylaws along with Michael Cullom.)&lt;/p&gt;

&lt;p&gt;I unfortunately left Drupal in 2017 under less-than-ideal circumstances (project leadership turned out to be far more
bigoted and dishonest than I could have imagined), but I remained active in the broader community, especially on the
conference circuit, where I was a frequent speaker at events around the world. At that time, I was working in developer
relations (&lt;em&gt;DevRel&lt;/em&gt;) for a hosting startup, while doing my own PHP work on the side.&lt;/p&gt;

&lt;p&gt;I joined the PHP Internals list during the GoPHP5 project, but I did not really get involved in contributing to PHP
itself until around 2020. The first RFC I ever posted was for Python-style &lt;em&gt;comprehensions&lt;/em&gt;, although it had no meaningful
implementation and was met with lukewarm reception, so I abandoned it. The first one that actually went anywhere was
Enums, which I collaborated with Ilija Tovilo on. He did the code, but did not want to be bothered with writing the
RFC in English or arguing on the &lt;em&gt;mailing list&lt;/em&gt;. I, fortunately, am very good at writing technical English and did not
mind arguing. :-) That was the first of several collaborations, and we have been working together ever since.&lt;/p&gt;

&lt;p&gt;I also self-published my first solo book, &lt;em&gt;Thinking Functionally in PHP&lt;/em&gt;, in 2020, based on the then newly released PHP
7.4. It was reasonably successful, and has since served as a guide for me in picking what features to work on for PHP.
How can we make PHP a better functional language? How can we make functional techniques easier to do? The Pipe
Operator, partial function application, Enums, and similar RFCs are all part of that overarching story.&lt;/p&gt;

&lt;p&gt;While I have published a few of my own PHP libraries over the years, my most ambitious was &lt;code&gt;Crell/Serde&lt;/code&gt;, released in
2022.&lt;/p&gt;

&lt;p&gt;I started it originally while working for TYPO3, as we needed a new &lt;em&gt;config-loader/deserializer&lt;/em&gt; that was more flexible
than anything else on the market, so I built it. Of course, TYPO3 ended up not using it, but yay, &lt;em&gt;Open Source&lt;/em&gt;: I was
still able to release it.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What is your current role, and what kind of work do you do on a daily basis?&lt;/h3&gt;

&lt;p&gt;As I write this, I am looking for a new job, so that is what I do.&lt;/p&gt;

&lt;p&gt;On the side, I have been working on a new &quot;mostly static&quot; site management tool for my own blog that is, I think, finally
close to done. (Famous last words.) I am also working on multiple PHP RFCs, in partnership with others, and planning an
update to my FP book, now that PHP has advanced significantly enough to warrant it.&lt;/p&gt;

&lt;p&gt;What I would like to be doing is leading a team, helping them level up their skills and modernize and improve an older
codebase. I find that fun, as long as management does not fight me on it. I&#039;m weird. :-)&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What has been the biggest challenge or most defining moment in your journey within the PHP ecosystem?&lt;/h3&gt;

&lt;p&gt;I do not think there has been just one!&lt;/p&gt;

&lt;p&gt;GoPHP5 was my first real foray into the broader community, and I think it set the stage for most of what came after for
me: collaboration, cross-project cooperation, and pushing the language forward. There was not even any code in it, just
people-wrangling and marketing. But it worked.&lt;/p&gt;

&lt;p&gt;The work we did to break Drupal out of its shell, as part of the overall PHP Renaissance, was the next logical step in
that process. That was a 5-year slog, and while the result was not quite what I had hoped, it was still a defining moment
for the project, and for me personally. It was in this era that I really made a name for myself in the PHP community
outside of Drupal.&lt;/p&gt;

&lt;p&gt;I have been a functional programming advocate since 2011, when I first gave a functional programming talk at a Drupal
conference. Of course, my knowledge in that area has grown considerably since then, and with my 2020 book I carved out a
position for myself as &quot;the FP guy&quot; in many PHP circles. Which I am OK with, and that has been one of the through-lines
of much of my PHP Internals work.&lt;/p&gt;

&lt;p&gt;Getting Enums into PHP was easier than some of the RFCs that came after, but it was also a major pivot point where I
became &quot;a core contributor.&quot; I do not know that it has gotten me anything beyond a need for heartburn medication, but it
was still a great feeling.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What do you believe was essential for you to reach your current position within the PHP ecosystem (whether in the core, the Foundation, or the community)?&lt;/h3&gt;

&lt;p&gt;Naivete and stubbornness.&lt;/p&gt;

&lt;p&gt;It did not occur to me what a big deal GoPHP5 was until I was well into it. I just wanted to be able to use &lt;code&gt;PDO&lt;/code&gt; for
Drupal&#039;s database layer. I did not set out to change the direction of the ecosystem, I just scratched an itch. Had I
realized just how big a deal it was, I may not have even gotten started. But once I was in, I followed through.&lt;/p&gt;

&lt;p&gt;My nominal remit for Drupal 8 was &lt;em&gt;web services&lt;/em&gt;. I did not set out to rewrite the whole system, but somewhere along the
way that became the way to make &lt;em&gt;web services&lt;/em&gt; work better, and so off we went. Had I realized I was signing up for 5
years of stress in a dysfunctional dev organization culminating in rewriting most of Drupal, I may not have even gotten
started. But once I was in, I followed through.&lt;/p&gt;

&lt;p&gt;I did not set out to get into &lt;em&gt;DevRel&lt;/em&gt;, but I enjoyed speaking at conferences, and that led into a &lt;em&gt;full-time&lt;/em&gt; &lt;em&gt;DevRel&lt;/em&gt;
position for 5 years, with tons of travel to all sorts of cool places.&lt;/p&gt;

&lt;p&gt;I did not set out to be &quot;the FP guy.&quot; I just wanted to make my code better, and share what I learned with others.&lt;/p&gt;

&lt;p&gt;As the old Engineers Creed goes, &quot;We do these things not because they are easy, but because we thought they would be
easy.&quot;&lt;/p&gt;

&lt;p&gt;Sometimes, &quot;just do it&quot; is the best way through. You do not know how big or small a task will be until you are in it. If
it is important, try. Sometimes you will fail, but that is OK. You got further than you would have if you had not tried.
And when you succeed, it is a really good feeling.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What kind of impact do you feel you currently have within the PHP ecosystem or community?&lt;/h3&gt;

&lt;p&gt;It is hard to judge. I would like to think I am a force for “taking the time to do it right.” The best feedback I
generally get is &quot;you made me think&quot; or &quot;I never thought of it that way, but you are right.&quot;&lt;/p&gt;

&lt;p&gt;Most recently, I had a long screed against the massive and negative environmental impacts of AI in my article
&lt;a href=&quot;https://www.garfieldtech.com/blog/selfish-ai&quot;&gt;Selfish AI&lt;/a&gt;, calling out those who embrace AI while ignoring those negative
externalities. I have had a lot of people thank me for putting into words what they were thinking.&lt;/p&gt;

&lt;p&gt;Perhaps that is my best impact: distilling squishy concepts into understandable steps and making them actionable. Whether
that is large-scale things like &quot;here&#039;s why we should convert Drupal to OOP&quot; or smaller things like &quot;here&#039;s how to think
about &lt;code&gt;null&lt;/code&gt;&quot; (&lt;a href=&quot;https://www.garfieldtech.com/blog/much-ado-about-null&quot;&gt;Much Ado About Null&lt;/a&gt;), I hope I am able to make the
people I work with smarter, more skilled, and open their minds to just what is out there.&lt;/p&gt;

&lt;p&gt;None of us know everything. All of us know very, very little, relative to what there is to know.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;About PHP and the PHP Foundation&lt;/h2&gt;

&lt;h3&gt;In your opinion, what have been the most significant advancements in PHP in recent years?&lt;/h3&gt;

&lt;p&gt;This seems minor, but constructor property promotion.&lt;/p&gt;

&lt;p&gt;Before PHP 8.0, making the case for clean dependency injection was... honestly kind of hard. Doing proper DI involved
typing out nearly the same series of characters (type and variable name) at least 4 times. Many devs, understandably,
just did not want to bother, and so did not. That is where ugly hacks like Laravel&#039;s &quot;facades&quot; come from.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Constructor promotion&lt;/em&gt;, while it is really &quot;just&quot; syntax sugar that compiles away, cuts that number down to 1. It makes
specifying &quot;this class requires X, Y, and Z&quot; just stupid easy. Combined with a good &lt;em&gt;autowiring&lt;/em&gt; DI container, in most
cases it is: &quot;write a class, list what you want, and you&#039;re done.&quot; The ergonomic benefits of that cannot be overstated.
(It also means Laravel facades are now addressing a problem that has not existed for 6 years, so everyone needs to stop
using them, right the heck now.)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Named arguments&lt;/em&gt; and &lt;em&gt;attributes&lt;/em&gt; came out at the same time, and the three of them dovetailed together
perfectly. PHP 8.0 really was a revolution.&lt;/p&gt;

&lt;p&gt;More recently, it may be self-serving to talk up the &lt;em&gt;Asymmetric Visibility&lt;/em&gt; and &lt;em&gt;Property Hooks&lt;/em&gt; RFCs that Ilija
and I wrote, but taken together (and with &lt;em&gt;interface properties&lt;/em&gt; we got along the way), they have completely changed how
one writes PHP code. (Or could/should.) &quot;Get me information about this object&quot; is now just a &lt;em&gt;property&lt;/em&gt;. Whether it is
&lt;em&gt;backed&lt;/em&gt; by a real value or not is irrelevant. It can be dynamic, cached, or just internally-writable-only. We are still
internalizing the effects of this change, but it is huge.&lt;/p&gt;

&lt;p&gt;And of course, the overall push toward a stronger type system, which has been an incremental process for years. I am a
strong believer in &lt;em&gt;type-driven development&lt;/em&gt;: the more logic you can push into your type system, and let the type system
force your code into certain shapes, the less code you actually need. PHP has the strongest enforced type system of any
major interpreted language. It really deserves more credit for that than it gets.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;In your view, what are the biggest challenges today for new contributors to get involved with the PHP core?&lt;/h3&gt;

&lt;p&gt;PHP is a &quot;structureless&quot; organization. This... has pros and cons. I strongly recommend everyone read
&quot;&lt;a href=&quot;https://www.jofreeman.com/joreen/tyranny.htm&quot;&gt;The Tyranny of Structurelessness&lt;/a&gt;&quot; by Jo Freeman.&lt;/p&gt;

&lt;p&gt;Even though the RFC process is nominally quite open and documented, the on-ramps are not clear. There are lots of
informal, unwritten rules about what is and is not acceptable, and who among the common reviewers is going to care about
what, and what informal gates you need to get past. (E.g., who is going to nitpick the language of the RFC, who is going
to nitpick the code, who is going to not review anything but just vote no in the end without any notice, etc.) If you are
not already &quot;in,&quot; it is quite daunting. Unfortunately, efforts to address this always run into a wall.&lt;/p&gt;

&lt;p&gt;The other big issue is that the PHP codebase itself is a mess. It is not actually written in C; it is written in a custom
macro language written in C, and the inline documentation in the code is paltry at best. Again, explanations and
documentation exist, at least for some of it, but an awful lot is just &quot;read this 10,000-line undocumented file with a
whole bunch of macros using terms you do not know yet, good luck.&quot;&lt;/p&gt;

&lt;p&gt;There are people who have managed to successfully learn the codebase in its current form. I envy them. I am still lost to
this day in most of it.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;How do you see the role of the PHP Foundation in the future of the language?&lt;/h3&gt;

&lt;p&gt;The PHP Foundation is, and has been, absolutely crucial to PHP&#039;s continued growth in the past half-decade. Around half of
all the merges to &lt;em&gt;php-src&lt;/em&gt; these days come from one of the Foundation&#039;s paid developers. That is not just RFCs and other
improvements (of which there are many), but also lots of bug fixing and unsung maintenance.&lt;/p&gt;

&lt;p&gt;I would really like the Foundation to take a stronger, more leading role in PHP. Not just in the code (where more
internal planning could be very helpful), but also in marketing to the broader community. We likely will not ever be able
to make PHP &quot;cool&quot;, but at least making it &quot;not uncool&quot; seems achievable.&lt;/p&gt;

&lt;p&gt;If your business uses PHP, you need to be donating to the Foundation. Not small amounts. This is our language, and if we
want it to continue to thrive, we need to collectively put our money where our mouth is.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;PHP still carries a reputation of being an “old” or “bad” language in certain circles. How do you view this image today?&lt;/h3&gt;

&lt;p&gt;&quot;JavaScript is such a stupid language. It does not even have classes, you have this callback hell nonsense, and what&#039;s up
with having to &lt;code&gt;parseInt()&lt;/code&gt; everything?&quot;&lt;/p&gt;

&lt;p&gt;That was a completely valid criticism of JavaScript... in 2005. If you tried to make that claim today, you&#039;d be laughed
at because your knowledge is 20 years out of date. (Although the type coercion is still bad.)&lt;/p&gt;

&lt;p&gt;The same is true of PHP... or at least it should be. Modern, properly written PHP is a really, really nice language, with
most of the features you would expect from a &quot;modern&quot; language. There are still a few gaps, sure; the same is true of
every other language. PHP 8.6 will have a more flexible &lt;em&gt;partial function application&lt;/em&gt; syntax than any other
language I know of. The type system is remarkably robust, lacking only &lt;em&gt;generics&lt;/em&gt;, which are, well, hard in an
interpreted language. (No one has it yet.)&lt;/p&gt;

&lt;p&gt;Yet PHP still carries the reputation of PHP 4, while JavaScript does not carry the reputation of JS 2005.&lt;/p&gt;

&lt;p&gt;Frankly, this disconnect is the single biggest threat to PHP. The language itself is fine. The ecosystem is strong. But
perception and marketing have been lacking for 20 years, and we are still feeling the pain of a generation of
programmers whose only knowledge of PHP was the &quot;fractal&quot; hit-piece from 14 years ago.&lt;/p&gt;

&lt;p&gt;It is not helped by the state of the WordPress codebase (the most famous and widely used PHP code on the planet), or some
of the... interesting design decisions in Laravel, neither of which use the language to its fullest modern extent.&lt;/p&gt;

&lt;p&gt;I firmly believe that addressing this image problem, proactively and aggressively, is the single biggest challenge for
PHP. It is not about the code, it is about perception. It is about running &lt;em&gt;bootcamps&lt;/em&gt; for new devs to learn PHP,
properly from the get-go. (Why are JS and React so popular? Because there are a million &lt;em&gt;bootcamps&lt;/em&gt; that churn out cheap
JS and React programmers.)&lt;/p&gt;

&lt;p&gt;I wish I had the time and energy to work on that, but it is not really where my skill set is, nor do I have the
bandwidth to do it as a side project. Hopefully this is an area the Foundation can help with, but it would require
expanding its scope beyond just the codebase. If we do not address that, it is going to strangle the language.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;To wrap up: what change or feature would you like to see in PHP in the coming years?&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Generics&lt;/em&gt;, obviously. :-)&lt;/p&gt;

&lt;p&gt;But more seriously, the most important shift that has been brewing, that we need to push harder on and make sure to get
right, is persistent-process PHP. FrankenPHP, Swoole, etc. are all part of that, but not quite right yet.&lt;/p&gt;

&lt;p&gt;It is not just about &lt;em&gt;async&lt;/em&gt;, though that is absolutely a critical part of it. We have had &lt;em&gt;async&lt;/em&gt; for years, but without
a unified &lt;em&gt;IO&lt;/em&gt; to handle blocking and non-blocking code, it has never really caught on. That is why the current efforts at
a new native Async API are so compelling, though I do feel they still need work.&lt;/p&gt;

&lt;p&gt;FrankenPHP &lt;em&gt;worker mode&lt;/em&gt; is also part of the picture, and for current projects is likely the easiest way forward. The
performance upsides are huge, but just as important, when PHP is not getting restarted every request you can spend less
effort on making the bootstrap process super-optimized.&lt;/p&gt;

&lt;p&gt;Think about how much work goes into compiling perfectly optimized DI containers, &lt;em&gt;event dispatchers&lt;/em&gt;, &lt;em&gt;template engines&lt;/em&gt;,
etc. Now imagine if none of that mattered. If it takes 100 extra milliseconds to start up a process, but only once, and
it takes 100 times less code effort than squeezing it down to 10 ms on every request, that is a massive win, both for
performance and for giving developers less work.&lt;/p&gt;

&lt;p&gt;FrankenPHP is still strictly &lt;em&gt;request/response/end&lt;/em&gt;, though, at least on a per-request level.&lt;/p&gt;

&lt;p&gt;Modern HTTP means lots of &lt;em&gt;micro-requests&lt;/em&gt;, &lt;em&gt;websockets&lt;/em&gt;, persistent connections, &lt;em&gt;push events&lt;/em&gt;, and using HTTP/3 and UDP.
That is not the world PHP and PHP-FPM were created for, but it is the world we need to be able to easily play in.&lt;/p&gt;

&lt;p&gt;I want to be able to spin up a new PHP server that will boot once and stay booted, has a simple API for firing up
&lt;em&gt;websockets&lt;/em&gt; and &lt;em&gt;push events&lt;/em&gt;, and lets me use all of my existing libraries and knowledge without having to relearn
everything.&lt;/p&gt;

&lt;p&gt;We are not there yet. But we are closer than PHP has ever been, and that is, on a technical level, the most important
feature we can be working on. Whether that means FrankenPHP, the &quot;true async&quot; RFC, something new built on top of both, I
do not know. But that is where PHP needs to go.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;Off-topic&lt;/h2&gt;

&lt;h3&gt;Are there any tools, libraries, or practices in the PHP ecosystem that you really enjoy using today?&lt;/h3&gt;

&lt;p&gt;Basically every PHP project I create these days starts with &lt;em&gt;PHPUnit&lt;/em&gt; and &lt;em&gt;PHPStan&lt;/em&gt;. I also have &lt;em&gt;PHPBench&lt;/em&gt; and
&lt;em&gt;PHPMetrics&lt;/em&gt; in my standard kit, although I do not use those as often.&lt;/p&gt;

&lt;p&gt;My Docker environment almost always comes from &lt;a href=&quot;https://phpdocker.io/&quot;&gt;PHPDocker.io&lt;/a&gt;. (Great for dev, not sure it is great
for prod.)&lt;/p&gt;

&lt;p&gt;I have also mostly replaced &lt;em&gt;Makefiles&lt;/em&gt; with &lt;a href=&quot;https://github.com/Enrise/Taskfile&quot;&gt;Taskfiles&lt;/a&gt;. They are pure bash and
easier to maintain since they do not need funky work to avoid GNU Make&#039;s C-oriented caching.&lt;/p&gt;

&lt;p&gt;My IDE of choice is IntelliJ by JetBrains. It is their &quot;generic&quot; version, and adding the PHP plugins turns it into
PHPStorm, but I also have some other language plugins installed as well.&lt;/p&gt;

&lt;p&gt;I do not do strict TDD, but I am a strong proponent of tests. Tests should be written in concert with the code being
tested. Which actually gets typed first can vary, and I do a little of each, but they should be written close enough
together that they show up in the same commit. Testable code is a really good proxy for decoupled, easy to modify, easy
to repurpose, easy to make faster when needed, etc.&lt;/p&gt;

&lt;p&gt;And of course Xdebug, without which I would be totally lost.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What sources do you follow to stay up to date with PHP and software development?&lt;/h3&gt;

&lt;p&gt;I am a regular reader of the PHP Internals list, naturally.&lt;/p&gt;

&lt;p&gt;I also follow the &lt;code&gt;#PHP&lt;/code&gt; tag on Mastodon, which gets me a lot of content I can see or ignore. I am on the &lt;a href=&quot;https://phpc.social/about&quot;&gt;PHPC.social&lt;/a&gt;
Mastodon server, where I am also a low-level moderator.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;Would you like to leave a message for the Brazilian PHP community?&lt;/h3&gt;

&lt;p&gt;The PHP-verse has long been dominated by Europeans, and secondarily by Americans. It does not have to be that way. That is
the beauty of &lt;em&gt;Free Software&lt;/em&gt;. Anyone, anywhere, can get involved. Help review proposals for Internals, release
libraries, contribute to existing projects, blog, write documentation, whatever suits your personal interest. You do not
need permission from anyone. You just need a little naivete and stubbornness. :-)&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Follow &lt;strong&gt;Larry&lt;/strong&gt; and explore his work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/crell&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/in/larry-garfield/&quot;&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://phpc.social/@Crell&quot;&gt;Mastodon (@Crell)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.garfieldtech.com/&quot;&gt;Garfield Tech&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-85-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-85-en" />
            <title>Discover the main new features in PHP 8.5</title>
            <published>2025-11-21T00:00:00+00:00</published>
            <updated>2025-11-21T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">PHP 8.5 arrived with features like the new URI extension, the pipe operator, and the ability to modify properties while cloning objects, making code simpler, more expressive, and future-ready. Check out the main highlights in this post.</summary>
            <content type="html">&lt;p&gt;As has been tradition over the last decade, PHP gets a new version every year, and now it&#039;s &lt;strong&gt;PHP 8.5&lt;/strong&gt;&#039;s turn.&lt;/p&gt;

&lt;p&gt;If you follow this blog or my &lt;a href=&quot;https://www.linkedin.com/in/marcosmarcolin/&quot;&gt;LinkedIn&lt;/a&gt;, you&#039;ve probably already seen some
of these new features, since I usually cover the most important RFCs and changes throughout the year.&lt;/p&gt;

&lt;p&gt;In this post, I bring a summary of the main improvements in 8.5. I picked out what makes the biggest difference
day-to-day, since a lot was developed throughout the year to make the language simpler, faster, and more consistent.&lt;/p&gt;

&lt;h2&gt;URI extension: parsing and manipulating URLs with a modern API - &lt;a href=&quot;https://wiki.php.net/rfc/url_parsing_api?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The new &lt;code&gt;URI&lt;/code&gt; extension now ships enabled by default in PHP 8.5. It provides dedicated APIs for parsing and modifying
URIs and URLs following the RFC 3986 and WHATWG URL standards.&lt;/p&gt;

&lt;p&gt;The implementation guarantees much more consistent parsing than &lt;code&gt;parse_url&lt;/code&gt;, which has always had limitations and
inconsistent behavior.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$components = parse_url(&#039;https://php.net/releases/8.4/en.php&#039;);
var_dump($components[&#039;host&#039;]);
// string(7) &quot;php.net&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;use Uri\Rfc3986\Uri;
$uri = new Uri(&#039;https://php.net/releases/8.5/en.php&#039;);
var_dump($uri-&amp;gt;getHost());
// string(7) &quot;php.net&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Pipe Operator: cleaner, more readable chaining - &lt;a href=&quot;https://wiki.php.net/rfc/pipe-operator-v3?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The pipe operator makes it easier to chain functions without creating intermediate variables and without nesting
calls. The flow reads top to bottom, making it much easier to read, maintain, and extend.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$title = &#039; PHP 8.5 Released &#039;;

$slug = strtolower(
    str_replace(&#039;.&#039;, &#039;&#039;,
        str_replace(&#039; &#039;, &#039;-&#039;,
            trim($title)
        )
    )
);

var_dump($slug);
// string(14) &quot;php-85-released&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$title = &#039; PHP 8.5 Released &#039;;

$slug = $title
    |&amp;gt; trim(...)
    |&amp;gt; (fn($str) =&amp;gt; str_replace(&#039; &#039;, &#039;-&#039;, $str))
    |&amp;gt; (fn($str) =&amp;gt; str_replace(&#039;.&#039;, &#039;&#039;, $str))
    |&amp;gt; strtolower(...);

var_dump($slug);
// string(14) &quot;php-85-released&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can check out my full explanation &lt;a href=&quot;https://www.marcosmarcolin.com.br/en/blog/php-pipe-operator-en&quot;&gt;at this link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Clone With: modify properties right in the clone - &lt;a href=&quot;https://wiki.php.net/rfc/clone_with_v2?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;PHP 8.5 introduced the ability to change properties during cloning, by passing an associative array to the
&lt;code&gt;clone()&lt;/code&gt; function.
This simplifies the &quot;with&quot; method pattern, very common in &lt;code&gt;readonly&lt;/code&gt; classes, eliminating repetitive code to
rebuild objects.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;readonly class UserProfile
{
    public function __construct(
        public string $name,
        public string $email,
        public string $role = &#039;user&#039;,
    ) {}

    public function withRole(string $role): self
    {
        $data = get_object_vars($this);
        $data[&#039;role&#039;] = $role;

        return new self(...$data);
    }
}

$profile = new UserProfile(&#039;Marcos&#039;, &#039;marcos@example.com&#039;);
$admin = $profile-&amp;gt;withRole(&#039;admin&#039;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;readonly class UserProfile
{
    public function __construct(
        public string $name,
        public string $email,
        public string $role = &#039;user&#039;,
    ) {}

    public function withRole(string $role): self
    {
        return clone($this, [
            &#039;role&#039; =&amp;gt; $role,
        ]);
    }
}

$profile = new UserProfile(&#039;Marcos&#039;, &#039;marcolindev@gmail.com&#039;);
$admin = $profile-&amp;gt;withRole(&#039;admin&#039;);
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;#[\NoDiscard] attribute: make sure the return value is used - &lt;a href=&quot;https://wiki.php.net/rfc/marking_return_value_as_important?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;#[\NoDiscard]&lt;/code&gt; attribute lets you mark functions whose return value shouldn&#039;t be ignored. If the return value
isn&#039;t used, PHP will emit a warning. This increases the safety of APIs where the return value is essential, avoiding
silent bugs.&lt;/p&gt;

&lt;p&gt;If you really want to discard the value, you can use the &lt;code&gt;(void)&lt;/code&gt; cast to make that intent explicit.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;function getPhpVersion(): string
{
    return &#039;PHP 8.4&#039;;
}

getPhpVersion(); // No warning
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;#[\NoDiscard]
function getPhpVersion(): string
{
    return &#039;PHP 8.5&#039;;
}

getPhpVersion();
// Warning: The return value of function getPhpVersion() should either be used or intentionally ignored
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can check out my full explanation
&lt;a href=&quot;https://www.marcosmarcolin.com.br/en/blog/no-discard-attribute-php-8-5-en&quot;&gt;at this link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Closures and first-class callables in constant expressions - &lt;a href=&quot;https://wiki.php.net/rfc/closures_in_const_expr?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt; - &lt;a href=&quot;https://wiki.php.net/rfc/fcc_in_const_expr?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;PHP 8.5 now allows the use of static closures and &lt;code&gt;first-class callables&lt;/code&gt; in constant expressions. This includes
attribute parameters, default values of properties and parameters, as well as constants inside a class.&lt;/p&gt;

&lt;p&gt;This feature opens the door to more expressive, reusable configurations, without needing helper functions or
extra blocks.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;class Example
{
    const HANDLER = fn() =&amp;gt; &#039;test&#039;; // Fatal error
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;class Example
{
    const HANDLER = (static fn() =&amp;gt; &#039;test&#039;);

    public function run(): string
    {
        return (self::HANDLER)();
    }
}

$e = new Example();
var_dump($e-&amp;gt;run()); 
// string(4) &quot;test&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can check out my full explanation
&lt;a href=&quot;https://www.marcosmarcolin.com.br/en/blog/closures-in-constant-expressions-php-85-en&quot;&gt;at this link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Persistent cURL Share Handles - &lt;a href=&quot;https://wiki.php.net/rfc/curl_share_persistence?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt; - &lt;a href=&quot;https://wiki.php.net/rfc/curl_share_persistence_improvement?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;PHP 8.5 introduced &lt;code&gt;curl_share_init_persistent()&lt;/code&gt;, which creates persistent share handles.
Unlike &lt;code&gt;curl_share_init()&lt;/code&gt;, these handles aren&#039;t destroyed at the end of the request.
If another handle with the same options already exists, it will be reused, avoiding initialization costs and
improving the performance of repeated requests.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$sh = curl_share_init();
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);

$ch = curl_init(&#039;https://php.net/&#039;);
curl_setopt($ch, CURLOPT_SHARE, $sh);

curl_exec($ch);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$sh = curl_share_init_persistent([
    CURL_LOCK_DATA_DNS,
    CURL_LOCK_DATA_CONNECT,
]);

$ch = curl_init(&#039;https://php.net/&#039;);
curl_setopt($ch, CURLOPT_SHARE, $sh);

// This can now reuse the connection from a previous SAPI request
curl_exec($ch);
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;&lt;code&gt;array_first()&lt;/code&gt; and &lt;code&gt;array_last()&lt;/code&gt; functions - &lt;a href=&quot;https://wiki.php.net/rfc/array_first_last?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;RFC&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;PHP 8.5 got two new functions for working with arrays: &lt;code&gt;array_first()&lt;/code&gt; and &lt;code&gt;array_last()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;They return, respectively, the first and last value of the array. If the array is empty, they return &lt;code&gt;null&lt;/code&gt;, which
is very handy when combined with the &lt;code&gt;??&lt;/code&gt; operator.&lt;/p&gt;

&lt;p&gt;PHP 8.4 and earlier&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$lastEvent = $events === []
    ? null
    : $events[array_key_last($events)];
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;PHP 8.5&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;$lastEvent = array_last($events);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can check out my full explanation &lt;a href=&quot;https://www.marcosmarcolin.com.br/en/blog/php-array-first-last-en/&quot;&gt;at this link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Additional features and improvements&lt;/h2&gt;

&lt;p&gt;Besides the main features in PHP 8.5, several smaller improvements were added to make development safer, more
consistent, and more predictable.&lt;/p&gt;

&lt;h3&gt;&lt;code&gt;Backtrace&lt;/code&gt; on fatal errors&lt;/h3&gt;

&lt;p&gt;Fatal errors, like exceeding maximum execution time, now display a &lt;code&gt;backtrace&lt;/code&gt; to make investigation easier.&lt;/p&gt;

&lt;h3&gt;More flexible attributes&lt;/h3&gt;

&lt;p&gt;Attributes can now be applied to constants.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;#[\Override]&lt;/code&gt; attribute can also now be used on properties.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;#[\Deprecated]&lt;/code&gt; attribute now works on traits and constants.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Property improvements&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Static properties now support asymmetric visibility.&lt;/li&gt;
&lt;li&gt;Constructor-promoted properties can be marked as final.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;New functions and internal API&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;New &lt;code&gt;Closure::getCurrent()&lt;/code&gt; method, useful for recursion in closures.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setcookie()&lt;/code&gt; and &lt;code&gt;setrawcookie()&lt;/code&gt; now accept the &lt;em&gt;partitioned&lt;/em&gt; key.&lt;/li&gt;
&lt;li&gt;New functions: &lt;code&gt;get_error_handler()&lt;/code&gt; and &lt;code&gt;get_exception_handler()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;New &lt;code&gt;grapheme_levenshtein()&lt;/code&gt; function for multibyte strings.&lt;/li&gt;
&lt;li&gt;New DOM methods: &lt;code&gt;Dom\Element::getElementsByClassName()&lt;/code&gt; and &lt;code&gt;Dom\Element::insertAdjacentHTML()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;#[\DelayedTargetValidation] attribute&lt;/h3&gt;

&lt;p&gt;Using the &lt;code&gt;#[\DelayedTargetValidation]&lt;/code&gt; attribute lets you suppress compile-time errors for attributes applied to invalid targets, useful for extensions and internal attributes.&lt;/p&gt;

&lt;h2&gt;Deprecations and backwards-compatibility breaks&lt;/h2&gt;

&lt;h3&gt;Syntax and operators&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The backtick operator as an alias for &lt;code&gt;shell_exec()&lt;/code&gt; has been deprecated.&lt;/li&gt;
&lt;li&gt;Non-canonical casts like &lt;code&gt;(boolean)&lt;/code&gt;, &lt;code&gt;(integer)&lt;/code&gt;, &lt;code&gt;(double)&lt;/code&gt;, and &lt;code&gt;(binary)&lt;/code&gt; have also been deprecated. Use &lt;code&gt;(bool)&lt;/code&gt;,
&lt;code&gt;(int)&lt;/code&gt;, &lt;code&gt;(float)&lt;/code&gt;, and &lt;code&gt;(string)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Engine and syntax adjustments&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;disable_classes&lt;/code&gt; INI directive has been removed.&lt;/li&gt;
&lt;li&gt;Terminating a &lt;code&gt;case&lt;/code&gt; with a semicolon has been deprecated.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;null&lt;/code&gt; as an array index, or when calling &lt;code&gt;array_key_exists()&lt;/code&gt;, is now deprecated. Use an empty string.&lt;/li&gt;
&lt;li&gt;It&#039;s no longer possible to use &lt;code&gt;array&lt;/code&gt; and &lt;code&gt;callable&lt;/code&gt; as alias names in &lt;code&gt;class_alias()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Serialization and lifecycle&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;__sleep()&lt;/code&gt; and &lt;code&gt;__wakeup()&lt;/code&gt; magic methods have been softly deprecated. The recommended approach is to use
&lt;code&gt;__serialize()&lt;/code&gt; and &lt;code&gt;__unserialize()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Conversions and additional warnings&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A warning is now emitted when converting &lt;code&gt;NAN&lt;/code&gt; to another type.&lt;/li&gt;
&lt;li&gt;Destructuring non-array values (except &lt;code&gt;null&lt;/code&gt;) using &lt;code&gt;[]&lt;/code&gt; or &lt;code&gt;list()&lt;/code&gt; now emits a warning.&lt;/li&gt;
&lt;li&gt;Conversions of &lt;code&gt;floats&lt;/code&gt; (or &lt;code&gt;strings&lt;/code&gt; that look like &lt;code&gt;floats&lt;/code&gt;) to &lt;code&gt;int&lt;/code&gt; that no longer fit the type now also raise a warning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Final thoughts&lt;/h2&gt;

&lt;p&gt;In my view, &lt;strong&gt;PHP 8.5&lt;/strong&gt; reinforces just how consistently the language keeps evolving. The new features are useful in day-to-day work, solve real problems, and make code clearer and more modern.&lt;/p&gt;

&lt;p&gt;Following the language&#039;s core continues to be something I really enjoy. Even without understanding every internal detail, you can see the care put into performance, safety, and runtime quality.&lt;/p&gt;

&lt;p&gt;And honestly, I don&#039;t need to get into that old debate about what PHP &quot;is or isn&#039;t.&quot; The language keeps delivering, keeps growing, and remains extremely relevant on its own merits.&lt;/p&gt;

&lt;p&gt;You can check out all the changes on the&lt;br /&gt;
&lt;a href=&quot;https://www.php.net/releases/8.5/en.php?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=php85&amp;amp;utm_id=2025&quot;&gt;official PHP site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Until next time!&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/blog/php-30-years-derick-rethans-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/blog/php-30-years-derick-rethans-en" />
            <title>🐘 PHP 30 Years – Interview with Derick Rethans</title>
            <published>2025-11-17T00:00:00+00:00</published>
            <updated>2025-11-17T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">Interview from the PHP 30 Years series with Derick Rethans.</summary>
            <content type="html">&lt;p&gt;This interview is part of the &lt;strong&gt;PHP 30 Years – Contributor Interview&lt;/strong&gt; series, created to celebrate three decades of the
language and highlight the people who helped and continue to help shape the PHP ecosystem.&lt;/p&gt;

&lt;p&gt;Derick Rethans is one of the most influential names in the history of PHP. He is the creator and maintainer of &lt;a href=&quot;https://xdebug.org/&quot;&gt;Xdebug&lt;/a&gt;,
an active core contributor, a member of the &lt;a href=&quot;https://thephp.foundation/&quot;&gt;PHP Foundation&lt;/a&gt;, and has been involved in several key changes that shaped the
evolution of the language.&lt;/p&gt;

&lt;p&gt;Below is the full interview.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;How did your journey with PHP begin, and what motivated you to keep contributing actively to the language?&lt;/h3&gt;

&lt;p&gt;I learned about PHP when I was in university, and we wanted to make a website that used a database to store some
information. The options around the year 2000 were quite limited. There was ASP (Classic), which cost money and was
rarely hosted, and there was PHP — something we could use for free and even self-host.&lt;/p&gt;

&lt;p&gt;Back then, everything used MySQL. And one of the features MySQL did not yet have was subqueries, something like
&lt;code&gt;SELECT * FROM table WHERE value IN (SELECT...)&lt;/code&gt;. So, quite naïvely, I implemented this as a feature in the MySQL
extension for PHP. For me, this was mostly an exercise in using C with the PHP extension API, and that code (
fortunately) never made it into the official PHP distribution.&lt;/p&gt;

&lt;p&gt;My first actual contribution that landed was an overhaul of the now-deprecated MCrypt extension. At that time, the
extension had changed how its C interface worked, which required a lot of work on the PHP side.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What is your current role, and what kind of work do you do on a daily basis?&lt;/h3&gt;

&lt;p&gt;I am currently one of the eleven people contracted by the PHP Foundation to work on the PHP project. Most of my time is
currently spent maintaining the server infrastructure, but I’ve also recently worked on improving the Date/Time
extension, created PIE, the new PECL, and many other smaller contributions.&lt;/p&gt;

&lt;p&gt;Besides PHP, I am the creator and sole maintainer of Xdebug, the PHP debugging tool. With every new PHP version, Xdebug
requires more work, and there is always a continuous flow of new features to implement.&lt;/p&gt;

&lt;p&gt;I also run &lt;a href=&quot;https://xdebug.cloud/&quot;&gt;Xdebug Cloud&lt;/a&gt;, a remote debugging solution designed for distributed teams that need to share a remote PHP
development machine.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What has been the biggest challenge or most defining moment in your journey within the PHP ecosystem?&lt;/h3&gt;

&lt;p&gt;Through my open source work on the PHP core and on Xdebug, I managed to find jobs at various companies.&lt;/p&gt;

&lt;p&gt;I eventually moved to Norway to work for eZ Systems, and after leaving there, I worked as a contractor writing PHP
extensions. One of those contracts was with MongoDB, which eventually turned into a full-time job. Now that I’ve left
that company as well, I continue working on PHP — through the Foundation, through contracting, and of course, through
Xdebug. PHP has been the red thread throughout my entire career.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What do you believe was essential for you to reach your current position within the PHP ecosystem (whether in the core, the Foundation, or the community)?&lt;/h3&gt;

&lt;p&gt;My contributions to the language and the creation of Xdebug were essential for reaching my current position in the PHP
ecosystem.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;What kind of impact do you feel you currently have within the PHP ecosystem or community?&lt;/h3&gt;

&lt;p&gt;I believe that with the PHP Foundation in place, we can be confident PHP will continue to evolve for another 30 years.
I’m very happy to be part of such a long and meaningful journey.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;About PHP and the PHP Foundation&lt;/h2&gt;

&lt;h3&gt;In your opinion, what have been the most significant advancements in PHP in recent years?&lt;/h3&gt;

&lt;p&gt;I think the best improvement has been the general ability to type your code. This makes it possible to write more
complete and professional code that is easier to reason about. At the same time, PHP hasn’t lost its roots as a “hacky
language,” still allowing you to quickly build small things in a fun and simple way.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;In your view, what are the biggest challenges today for new contributors to get involved with the PHP core?&lt;/h3&gt;

&lt;p&gt;PHP, like any language, is complex. It takes a long time to understand everything that’s going on. With the PHP
Foundation, we are working on improving the documentation, but most of it is still “the source code itself.”&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;How do you see the role of the PHP Foundation in the future of the language?&lt;/h3&gt;

&lt;p&gt;I think it’s very important to have the Foundation as the backbone of the project. I would like to see it evolve into
also handling the governance of the project in a more professional way. Right now, nothing is clearly defined, and some
processes still happen in an improvised manner.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;PHP still carries a reputation of being an “old” or “bad” language in certain circles. How do you view this image today?&lt;/h3&gt;

&lt;p&gt;I ignore this entirely. It’s not a useful way of framing what the PHP language is. What matters is showcasing what PHP
is today.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;To wrap up: what change or feature would you like to see in PHP in the coming years?&lt;/h3&gt;

&lt;p&gt;Not Generics.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;Off-topic&lt;/h2&gt;

&lt;h3&gt;What sources do you follow to stay up to date with PHP and software development?&lt;/h3&gt;

&lt;p&gt;I read the internals mailing list, participate in the PHP Foundation Slack, the &lt;a href=&quot;https://phpc.chat/&quot;&gt;phpc.chat&lt;/a&gt; Discord server, and attend
user groups — both local and remote as well as conferences where I talk to people directly.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;Would you like to leave a message for the Brazilian PHP community?&lt;/h3&gt;

&lt;p&gt;I very much enjoyed my time speaking in São Paulo in 2006. I must find an excuse to visit again!&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Follow &lt;strong&gt;Derick&lt;/strong&gt; and explore his work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/derickr&quot;&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/in/derickrethans&quot;&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://xdebug.org/&quot;&gt;Xdebug&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://derickrethans.nl/&quot;&gt;Website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/dev-talks-2025-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/dev-talks-2025-en" />
            <title>Taking part in DevTalks 2025</title>
            <published>2025-11-12T00:00:00+00:00</published>
            <updated>2025-11-12T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">I took part as a panelist at DevTalks 2025 in Chapecó, in a conversation about development experiences, challenges with new and legacy technologies, and reflections on simplicity and overengineering.</summary>
            <content type="html">&lt;p&gt;Last weekend, I had the chance to take part as a panelist at &lt;strong&gt;DevTalks 2025&lt;/strong&gt;, sharing the stage with great professionals from companies in Chapecó (Brazil).&lt;/p&gt;

&lt;p&gt;It was a very rich conversation, &lt;strong&gt;where we got to share experiences from the daily life of development teams, discuss concerns around new and legacy technologies, and even touch on topics like &lt;em&gt;overengineering&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thanks to João Alfredo Zonta for the invitation, and congratulations to the whole team for the excellent organization, the event was a success!&lt;/p&gt;

&lt;p&gt;I was really excited to see another event of this caliber come to life in Chapecó. Bring on the next one! 👏🚀&lt;/p&gt;

&lt;p&gt;Learn more about the event at: &lt;a href=&quot;https://devtalks.com.br/&quot;&gt;www.devtalks.com.br&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/blog/devtalks/2025/1.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/2.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/3.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/4.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/5.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/6.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/devtalks/2025/7.jpg&quot; alt=&quot;DevTalks 2025&quot; /&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/phpeste-2025-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/phpeste-2025-en" />
            <title>I took part in PHPeste 2025 in Parnaíba – PI</title>
            <published>2025-10-15T00:00:00+00:00</published>
            <updated>2025-10-15T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">An amazing experience in Parnaíba, speaking at PHPeste 2025 and experiencing firsthand the strength of the PHP community in Brazil&#039;s Northeast.</summary>
            <content type="html">&lt;p&gt;In early October, I was in Parnaíba - PI (Brazil) to attend and speak at &lt;strong&gt;PHPeste 2025&lt;/strong&gt;. 🐘&lt;/p&gt;

&lt;p&gt;I had the chance to give a talk titled &lt;strong&gt;&quot;Contributing transforms: how your actions can redefine your career&quot;&lt;/strong&gt;, talking about how contributing can impact our journey, as well as sharing personal experiences that helped me grow in several professional and personal ways.&lt;/p&gt;

&lt;p&gt;Thanks to PHP Piauí, the community responsible for organizing this year&#039;s edition, who worked really hard to make the event a success. I think it&#039;s really cool that every edition is organized by a different community from the Northeast, further strengthening the spirit of collaboration.&lt;/p&gt;

&lt;p&gt;It was my first time at the event, and I plan to come back next year, which will be held in Maranhão.&lt;/p&gt;

&lt;p&gt;Beyond the knowledge gained and shared, the highlight of the event is the bonds created and strengthened, the sense of community, the opportunities that come up, and also the experience of getting to know new places and cultures.&lt;/p&gt;

&lt;p&gt;(Coming back from ~40°C in Parnaíba to ~15°C in Chapecó... my body is still processing it 😅).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/blog/phpeste/2025/1.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/phpeste/2025/2.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/phpeste/2025/3.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/phpeste/2025/4.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/phpeste/2025/5.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/phpeste/2025/6.jpeg&quot; alt=&quot;PHPeste 2025&quot; /&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/codecon-2025-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/codecon-2025-en" />
            <title>Taking part in Codecon 2025</title>
            <published>2025-07-21T00:00:00+00:00</published>
            <updated>2025-07-21T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">I attended Codecon in Curitiba and came back with reinforced ideas -&gt; focus on simplicity, on what works, and on what really matters in development.</summary>
            <content type="html">&lt;p&gt;Last weekend, I got to attend &lt;strong&gt;Codecon&lt;/strong&gt; in Curitiba, in partnership with &lt;strong&gt;IXC Soft&lt;/strong&gt;, together with some teammates.&lt;/p&gt;

&lt;p&gt;It was the first edition I attended, and it was a great experience. The structure and organization were outstanding.&lt;/p&gt;

&lt;p&gt;💡 Even better was hearing important talks from some speakers, often going against what the industry makes you (someone new to the field) believe, and lining up exactly with my own way of thinking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Write the simplest code possible,&lt;/strong&gt; that&#039;s easy to maintain and test.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use the simplest technologies to&lt;/strong&gt; solve your initial problem, preferably something you already know well.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;AI as your assistant&lt;/strong&gt;. It won&#039;t take anyone&#039;s job, unless you don&#039;t know how to use it. It&#039;ll get things wrong a lot, you need at least some judgment to use it well.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Only think about scaling once you actually start having real problems,&lt;/strong&gt; not the ones that only exist in your head.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Observability is very important&lt;/strong&gt; for making project decisions instead of shooting in the dark.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A well-structured monolith will solve most cases.&lt;/strong&gt; Only in very specific exceptions will you need microservices or other extra machinery.&lt;/li&gt;
&lt;li&gt;Beginners should aim for &lt;strong&gt;depth&lt;/strong&gt;, not quantity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Congratulations to everyone involved in the organization!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/blog/codecon-2025/1.jpeg&quot; alt=&quot;Codecon 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/codecon-2025/2.jpeg&quot; alt=&quot;Codecon 2025&quot; /&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/how-php-velho-oeste-2025-went-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/how-php-velho-oeste-2025-went-en" />
            <title>How PHP Velho Oeste 2025 went</title>
            <published>2025-06-10T00:00:00+00:00</published>
            <updated>2025-06-10T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">In its third edition, PHP Velho Oeste brought together nearly 250 attendees in Chapecó for two days full of knowledge, networking, and strengthening the community. A non-profit event made by and for those who believe in the power of PHP.</summary>
            <content type="html">&lt;p&gt;In late May, Chapecó hosted the third edition of &lt;strong&gt;PHP Velho Oeste&lt;/strong&gt;, an event born with the purpose of strengthening the PHP community in western Santa Catarina (Brazil), and one that keeps growing every year.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In 2025, we brought together nearly 250 attendees&lt;/strong&gt; and managed to provide an even better experience for everyone there. It was two days of learning, connections, and exchanging experiences among professionals, enthusiasts, and companies who share a passion for PHP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our purpose as an organization is clear: bring the PHP community together, share knowledge, and create new opportunities through networking.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It&#039;s worth reinforcing that PHP Velho Oeste is a non-profit initiative.&lt;/strong&gt; Every bit raised through tickets and sponsorships is reinvested back into the event itself: whether in more complete coffee breaks, supporting speakers&#039; travel, or producing exclusive materials for attendees.&lt;/p&gt;

&lt;p&gt;Behind the scenes, a committed team worked hard to make sure everything went as well as possible.&lt;/p&gt;

&lt;p&gt;And finally, a special thanks to everyone who made this edition possible: attendees, speakers, sponsors, and supporters. Each one was essential to the success of another year of the event.&lt;/p&gt;

&lt;p&gt;It&#039;s incredibly rewarding to be part of this.&lt;/p&gt;

&lt;p&gt;Until next time! 🐘🌵🚀&lt;/p&gt;

&lt;p&gt;Learn more about how it went on the event&#039;s &lt;a href=&quot;https://phpvelhoeste.com.br/2025?utm_source=site&amp;amp;utm_medium=linkedin&amp;amp;utm_campaign=marcosmarcolin&amp;amp;utm_id=2025&quot;&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/1.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/2.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/3.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/4.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/5.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;
&lt;img src=&quot;/assets/images/blog/php-velho-oeste-2025/6.jpeg&quot; alt=&quot;PHP Velho Oeste 2025&quot; /&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-pipe-operator-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-pipe-operator-en" />
            <title>The &quot;Pipe&quot; Operator |&gt; in PHP 8.5</title>
            <published>2025-05-18T00:00:00+00:00</published>
            <updated>2025-05-18T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">PHP 8.5 will bring a new operator, the Pipe Operator |&gt;.</summary>
            <content type="html">&lt;p&gt;🐘 &lt;strong&gt;PHP 8.5&lt;/strong&gt; will bring a new operator: the Pipe Operator &lt;code&gt;|&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Yes, an old proposal for the language will finally be implemented, &lt;strong&gt;adding a new operator to PHP.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The operator has the following syntax:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

mixed |&amp;gt; callable;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The |&gt; operator, known as &lt;strong&gt;pipe&lt;/strong&gt;, &lt;strong&gt;evaluates the expression on the left and passes it as an argument to the
function or callable on the right,&lt;/strong&gt; returning the result of the call.&lt;/p&gt;

&lt;p&gt;This means the two code snippets below are logically equivalent:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

// Without Pipe
echo strlen(&quot;Hello World&quot;); // 11
// With Pipe
echo &quot;Hello World&quot; |&amp;gt; strlen(...); // 11

// Chaining function calls

// Without Pipe
$input = &quot;  Marcos Marcolin  &quot;;
$temp = trim($input);
$temp = strtolower($temp);
$temp = ucwords($temp);
echo $temp; // Marcos Marcolin

// With Pipe
echo &quot;  Marcos Marcolin  &quot;
    |&amp;gt; trim(...)
    |&amp;gt; strtolower(...)
    |&amp;gt; ucwords(...); // Marcos Marcolin
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At first glance, it might seem of little use. But when chaining several calls, the pipe operator makes the code much
more readable and expressive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The left-hand side of the operator can be any value or expression.&lt;/li&gt;
&lt;li&gt;The right-hand side must be a valid PHP callable (function, method, or closure) that accepts only one parameter.&lt;/li&gt;
&lt;li&gt;Functions that require more than one mandatory argument aren&#039;t compatible and will raise an error for insufficient arguments.&lt;/li&gt;
&lt;li&gt;If the right-hand side doesn&#039;t evaluate to a valid callable, an error will be thrown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Practical example with string transformation:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

// Without pipe
$temp = &quot;Hello World&quot;;
$temp = htmlentities($temp);
$temp = str_split($temp);
$temp = array_map(strtoupper(...), $temp);
$temp = array_filter($temp, fn($v) =&amp;gt; $v != &#039;O&#039;);
$result = $temp;

// With pipe
$result = &quot;Hello World&quot;
    |&amp;gt; htmlentities(...)
    |&amp;gt; str_split(...)
    |&amp;gt; fn($x) =&amp;gt; array_map(strtoupper(...), $x)
    |&amp;gt; fn($x) =&amp;gt; array_filter($x, fn($v) =&amp;gt; $v != &#039;O&#039;);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Example with pipe on functions and objects:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

function getUsers(): array {
    return [
        new User(&#039;root&#039;, isAdmin: true),
        new User(&#039;marcos.marcolin&#039;, isAdmin: false),
    ];
}

function isAdmin(User $user): bool {
    return $user-&amp;gt;isAdmin;
}

// This is the new syntax.
$numberOfAdmins = getUsers()
    |&amp;gt; fn ($list) =&amp;gt; array_filter($list, isAdmin(...)) 
    |&amp;gt; count(...);

var_dump($numberOfAdmins); // int(1);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At first, the syntax might sound a bit strange to those used to traditional operators.
But once you understand the proposal, it turns out to be an elegant and powerful addition to the language.&lt;/p&gt;

&lt;p&gt;You can read more about the &lt;strong&gt;RFC&lt;/strong&gt; in the official post: &lt;a href=&quot;https://wiki.php.net/rfc/pipe-operator-v3&quot;&gt;click here&lt;/a&gt;.&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-array-first-last-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-array-first-last-en" />
            <title>array_first() and array_last() in PHP 8.5</title>
            <published>2025-05-07T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">PHP 8.5 will have two new array functions — array_first() and array_last(), making it easier to access the first and last elements.</summary>
            <content type="html">&lt;p&gt;🐘 &lt;strong&gt;PHP 8.5&lt;/strong&gt; will have two more array functions: &lt;code&gt;array_first()&lt;/code&gt; and &lt;code&gt;array_last()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, we&#039;ll have dedicated functions to get the first and last elements of an array, without needing to use functions that lack a consistent pattern or that mutate the array internally.&lt;/p&gt;

&lt;p&gt;These functions complement the already existing &lt;code&gt;array_key_first()&lt;/code&gt; and &lt;code&gt;array_key_last()&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

$colors = [&#039;red&#039;, &#039;green&#039;, &#039;blue&#039;];

/* Before PHP 8.5 */

// First element
echo reset($colors); // red
echo $colors[array_key_first($colors)]; // red

// Last element
echo end($colors); // blue
echo $colors[array_key_last($colors)]; // blue

/* 🐘 With PHP 8.5 */
echo array_first($colors); // red
echo array_last($colors); // blue
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Update: the functions shipped in PHP 8.5&lt;/h2&gt;

&lt;p&gt;The RFC was accepted and both functions are part of PHP 8.5, released on November 20, 2025. If you want to see what else arrived in that version, I wrote a summary in &lt;a href=&quot;/en/blog/php-85-en&quot;&gt;what&#039;s new in PHP 8.5&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Why &lt;code&gt;reset()&lt;/code&gt; and &lt;code&gt;end()&lt;/code&gt; weren&#039;t enough&lt;/h2&gt;

&lt;p&gt;Two new functions for something you could already do may sound like a small thing, but the old alternatives had a few problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;They change the array&#039;s internal pointer.&lt;/strong&gt; &lt;code&gt;reset()&lt;/code&gt; and &lt;code&gt;end()&lt;/code&gt; don&#039;t just return the value, they move the pointer. If some other piece of code uses &lt;code&gt;current()&lt;/code&gt;, &lt;code&gt;next()&lt;/code&gt; or &lt;code&gt;key()&lt;/code&gt; on the same array, its behavior changes without anyone noticing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;They take the array by reference.&lt;/strong&gt; Because of that, you can&#039;t pass a function&#039;s return value directly: &lt;code&gt;end(explode(&#039;,&#039;, $csv))&lt;/code&gt; raises the &lt;em&gt;Only variables should be passed by reference&lt;/em&gt; notice. You need an intermediate variable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;They return &lt;code&gt;false&lt;/code&gt; when the array is empty.&lt;/strong&gt; In an array that may contain &lt;code&gt;false&lt;/code&gt; as a value, you can&#039;t tell whether the array was empty or the first element really was &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;code&gt;array_key_first()&lt;/code&gt; and &lt;code&gt;array_key_last()&lt;/code&gt; these problems go away, but the code gets verbose, because you need the key first and then use it to access the value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;array_first()&lt;/code&gt; and &lt;code&gt;array_last()&lt;/code&gt; solve this: they take the array by value, don&#039;t touch the internal pointer and accept any expression as an argument.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

$csv = &#039;php,go,rust&#039;;

// Before: needed an intermediate variable
$languages = explode(&#039;,&#039;, $csv);
echo end($languages); // rust

// PHP 8.5
echo array_last(explode(&#039;,&#039;, $csv)); // rust
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;What about empty arrays?&lt;/h2&gt;

&lt;p&gt;Both functions return &lt;code&gt;null&lt;/code&gt; when the array is empty:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

var_dump(array_first([])); // NULL
var_dump(array_last([]));  // NULL
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If your array can hold &lt;code&gt;null&lt;/code&gt; as a valid value, the return value alone isn&#039;t enough to tell the two cases apart. In that situation, check whether the array is empty first or use &lt;code&gt;array_key_first()&lt;/code&gt;, which only returns &lt;code&gt;null&lt;/code&gt; when there are no elements.&lt;/p&gt;

&lt;h2&gt;Associative arrays and out-of-order keys&lt;/h2&gt;

&lt;p&gt;The functions follow the &lt;strong&gt;order of the elements in the array&lt;/strong&gt;, not the value of the keys. That applies to associative arrays and to lists with out-of-order indexes:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

$user = [&#039;name&#039; =&amp;gt; &#039;Marcos&#039;, &#039;role&#039; =&amp;gt; &#039;dev&#039;, &#039;country&#039; =&amp;gt; &#039;BR&#039;];

echo array_first($user); // Marcos
echo array_last($user);  // BR

$scores = [10 =&amp;gt; &#039;a&#039;, 2 =&amp;gt; &#039;b&#039;, 7 =&amp;gt; &#039;c&#039;];

echo array_first($scores); // a (first inserted, not the lowest key)
echo array_last($scores);  // c
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Using them on older PHP versions&lt;/h2&gt;

&lt;p&gt;If your project still runs on a version older than 8.5, you can write a simple &lt;em&gt;polyfill&lt;/em&gt; that is only declared when the native function doesn&#039;t exist:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

if (!function_exists(&#039;array_first&#039;)) {
    function array_first(array $array): mixed
    {
        foreach ($array as $value) {
            return $value;
        }

        return null;
    }
}

if (!function_exists(&#039;array_last&#039;)) {
    function array_last(array $array): mixed
    {
        return $array === [] ? null : $array[array_key_last($array)];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When the project upgrades to PHP 8.5, the native functions are used automatically, without changing a single call.&lt;/p&gt;

&lt;p&gt;You can read more about the RFC in the official post: &lt;a href=&quot;https://wiki.php.net/rfc/array_first_last&quot;&gt;click here&lt;/a&gt;.&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/php-written-in-php-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/php-written-in-php-en" />
            <title>🧪 PHP being written in... PHP?</title>
            <published>2025-04-01T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">This isn&#039;t an April Fools&#039; joke, this proposal is real.</summary>
            <content type="html">&lt;p&gt;A recent PoC (proof of concept) in PHP&#039;s Core caught my attention: &lt;strong&gt;implementing internal functions using pure PHP,
instead of C.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Link to the proposal (PoC): &lt;a href=&quot;https://github.com/php/php-src/pull/18204&quot;&gt;PR 18204&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A practical example was rewriting some &lt;code&gt;array_*()&lt;/code&gt; functions entirely in PHP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Yes, PHP implementing parts of PHP itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The goal isn&#039;t to replace C, after all, the language&#039;s interpreter is written in it, but to make room for
some internal functions to be written directly in PHP, without meaningfully impacting performance.&lt;/p&gt;

&lt;p&gt;This can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce complexity&lt;/li&gt;
&lt;li&gt;Make collaboration easier&lt;/li&gt;
&lt;li&gt;Make internal code more accessible (including for IDEs)&lt;/li&gt;
&lt;li&gt;Lower maintenance costs and the chance of bugs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, this breaks down a barrier that exists today for people who want to contribute to the Core but aren&#039;t
very familiar with C, systems, or compilers.&lt;/p&gt;

&lt;p&gt;Of course: it&#039;s still a proof of concept and is under discussion.&lt;/p&gt;

&lt;h2&gt;How internal functions are written today&lt;/h2&gt;

&lt;p&gt;When you call &lt;code&gt;array_map()&lt;/code&gt;, &lt;code&gt;str_contains()&lt;/code&gt; or &lt;code&gt;json_encode()&lt;/code&gt;, you&#039;re running C code. These functions live in the &lt;code&gt;php-src&lt;/code&gt; extensions (the array functions, for example, are in &lt;code&gt;ext/standard/array.c&lt;/code&gt;) and are written using the Zend API, the layer the interpreter exposes for handling arrays, strings, objects and reference counting.&lt;/p&gt;

&lt;p&gt;Alongside the C code, each extension has &lt;code&gt;.stub.php&lt;/code&gt; files, which describe the function signatures in PHP syntax. They are used to generate the argument and type metadata, and they are what IDEs and static analysis tools end up reading. So there is already PHP involved, but only to describe the functions, not to implement them.&lt;/p&gt;

&lt;p&gt;To contribute a new function today, you need to understand C, the Zend API, the engine&#039;s memory management and the macros the code relies on. That&#039;s a high barrier to entry.&lt;/p&gt;

&lt;h2&gt;What the PoC proposes&lt;/h2&gt;

&lt;p&gt;The PR rewrites &lt;code&gt;array_find()&lt;/code&gt; and related functions in plain PHP and removes the C implementation. The PHP version is very close to what any developer would write in &lt;em&gt;userland&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

function array_find(array $array, callable $callback): mixed
{
    foreach ($array as $key =&amp;gt; $value) {
        if ($callback($value, $key)) {
            return $value;
        }
    }

    return null;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;By comparison, the C version has to deal with iterating over the HashTable, calling the &lt;em&gt;callback&lt;/em&gt; through the Zend API, reference counting the return value and handling exceptions. It does the same thing, just with much more code and many more places for a mistake to slip through.&lt;/p&gt;

&lt;p&gt;In the PoC, this code is loaded through OPcache &lt;em&gt;preloading&lt;/em&gt;, so it&#039;s already compiled when the script starts. A production version would probably use a similar mechanism.&lt;/p&gt;

&lt;h2&gt;What about performance?&lt;/h2&gt;

&lt;p&gt;Intuition says C is always faster, but that&#039;s not quite true for functions that take &lt;em&gt;callbacks&lt;/em&gt;. When a C function calls a closure written in PHP, the engine has to leave native code, re-enter the virtual machine, run the closure and come back. Doing that for every element is expensive.&lt;/p&gt;

&lt;p&gt;When the whole function is in PHP, the loop and the &lt;em&gt;callback&lt;/em&gt; call happen inside the virtual machine itself. With the JIT enabled, the difference can be even smaller. The PoC&#039;s author included benchmarks comparing both versions, and that is exactly the central argument: for this kind of function, writing it in PHP doesn&#039;t bring a relevant performance loss.&lt;/p&gt;

&lt;p&gt;That doesn&#039;t apply to everything. Functions that do heavy processing without calling user code, like hashing, compression or parsing, are still better off in C.&lt;/p&gt;

&lt;h2&gt;The challenges&lt;/h2&gt;

&lt;p&gt;The idea is good, but there are open questions that are part of the discussion:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Identical behavior.&lt;/strong&gt; The PHP version has to behave exactly like the C version: same errors, same messages, same behavior with &lt;code&gt;strict_types&lt;/code&gt;. Any difference is a backward compatibility break.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Startup cost.&lt;/strong&gt; The PHP code has to be compiled at some point. Without OPcache, that would happen on every request.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stack traces.&lt;/strong&gt; An internal function written in PHP may show up in error traces differently from what people are used to.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Where to stop.&lt;/strong&gt; There need to be clear criteria for which functions make sense in PHP and which should stay in C.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As of this update, the proposal is still a proof of concept and hasn&#039;t become an accepted RFC. Even so, I find the discussion valuable: it challenges the idea that everything in the core has to be written in C, and it may open the door to the Core for many more people in the community.&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/legacy-software-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/legacy-software-en" />
            <title>🦖⚠️ The code is old, but the learning is new</title>
            <published>2025-03-31T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">💡🔨 Working with legacy software taught me valuable lessons that don&#039;t always come with new projects.</summary>
            <content type="html">&lt;p&gt;What a lot of devs think about &lt;strong&gt;Legacy Software&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Messy code&lt;/li&gt;
&lt;li&gt;Lack of tests&lt;/li&gt;
&lt;li&gt;Fear of touching it&lt;/li&gt;
&lt;li&gt;&quot;Old stuff, keep away from me!&quot;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ But I see it differently.&lt;/p&gt;

&lt;p&gt;🔨 Working with legacy software taught me valuable lessons that don&#039;t always come with new projects.&lt;/p&gt;

&lt;p&gt;Legacy code demands care, small changes can have big impacts.&lt;/p&gt;

&lt;p&gt;But for those who face it head-on, there&#039;s a lot to learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learning to read code with empathy, understanding old decisions, business context, and technical constraints&lt;/li&gt;
&lt;li&gt;Developing the skill of refactoring responsibly, in small steps, without breaking everything&lt;/li&gt;
&lt;li&gt;Valuing documentation and version control more&lt;/li&gt;
&lt;li&gt;Understanding the real impact of every change on systems that are live and serve thousands of users&lt;/li&gt;
&lt;li&gt;Optimizing slow parts, removing dead code, and delivering direct value to the business&lt;/li&gt;
&lt;li&gt;And gaining something only time and practice can give you: real experience with living systems&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;In practice: how to change legacy code safely&lt;/h2&gt;

&lt;p&gt;Talking about learning is easy. The hard part is day to day: opening a file with thousands of lines, no tests, and needing to change a business rule. A few practices help a lot in that scenario.&lt;/p&gt;

&lt;h3&gt;Understand before you change&lt;/h3&gt;

&lt;p&gt;Before changing anything, it&#039;s worth finding out why the code is the way it is. The Git history usually has the answer:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;# Who changed each line and in which commit
git blame src/Billing/InvoiceCalculator.php

# History of a specific part of the file
git log -L 120,180:src/Billing/InvoiceCalculator.php
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Often, that weird &lt;code&gt;if&lt;/code&gt; handles a real case from a customer, and the commit message or the linked ticket explain why. Removing it without understanding is the fastest way to bring back an old bug.&lt;/p&gt;

&lt;h3&gt;Write characterization tests&lt;/h3&gt;

&lt;p&gt;In code without tests, the first step isn&#039;t refactoring, it&#039;s &lt;strong&gt;recording the current behavior&lt;/strong&gt;. Characterization tests don&#039;t check whether the code is right, they check that it keeps doing what it does today:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

use PHPUnit\Framework\TestCase;

final class InvoiceCalculatorTest extends TestCase
{
    public function testKeepsCurrentBehaviorForLateInvoices(): void
    {
        $calculator = new InvoiceCalculator();

        // Value taken by running the current code, not calculated by hand
        $this-&amp;gt;assertSame(107.35, $calculator-&amp;gt;total(100.0, daysLate: 12));
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With a few tests like this covering the part you&#039;re about to touch, refactoring stops being a leap in the dark. If any result changes, you find out right away, not through support.&lt;/p&gt;

&lt;h3&gt;Change a little at a time&lt;/h3&gt;

&lt;p&gt;Large refactorings in legacy systems are risky and hard to review. Small changes, with separate commits for &quot;refactor&quot; and &quot;change behavior&quot;, are easier to understand, review and, if needed, revert.&lt;/p&gt;

&lt;p&gt;The boy scout rule helps here: whenever you pass through a piece of code for a task, leave it a bit better than you found it. A clearer variable name, an extracted function, an added type. Over months, that changes the system without any big rewrite project.&lt;/p&gt;

&lt;h3&gt;Use static analysis with a baseline&lt;/h3&gt;

&lt;p&gt;Tools like PHPStan and Psalm are valuable in legacy systems, but the first run usually shows thousands of errors. The baseline feature solves that: it records the existing errors and makes the analysis fail only on &lt;strong&gt;new&lt;/strong&gt; ones. The system stops getting worse from that day on, and the old code gets fixed little by little.&lt;/p&gt;

&lt;h3&gt;Replace in parts, not all at once&lt;/h3&gt;

&lt;p&gt;The temptation to rewrite everything from scratch is big, and it&#039;s almost always a mistake: the new system has to reproduce years of business rules nobody documented, while the old one keeps getting changes.&lt;/p&gt;

&lt;p&gt;A safer alternative is the &lt;em&gt;Strangler Fig&lt;/em&gt; pattern: new features and rewritten modules live in a new structure, while the rest stays in the old code. Gradually, the new part grows and the old one shrinks, without a big switchover.&lt;/p&gt;

&lt;h3&gt;Remove dead code with data&lt;/h3&gt;

&lt;p&gt;Dead code raises maintenance cost and confuses whoever reads it. But in old systems, &quot;looks like nobody uses it&quot; isn&#039;t enough. Logs, access metrics and code coverage reports from production help confirm that a piece of code really isn&#039;t executed before removing it.&lt;/p&gt;

&lt;p&gt;Legacy software is scary, but it also teaches.&lt;/p&gt;

&lt;p&gt;I&#039;m not romanticizing or glamorizing legacy code.&lt;/p&gt;

&lt;p&gt;But that&#039;s the reality of a good part of the market, especially when we&#039;re talking about systems that already deliver value, generate
revenue, and solve real problems every day.&lt;/p&gt;

&lt;p&gt;💸 What&#039;s more: professionals who master legacy systems with an eye for improvement, stability, and delivering value are usually
well recognized, often with &lt;strong&gt;above-average market pay.&lt;/strong&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/build-a-long-term-career-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/build-a-long-term-career-en" />
            <title>Build a long-term career 💡💼</title>
            <published>2025-03-27T00:00:00+00:00</published>
            <updated>2025-03-27T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">💡💼 We live in a fast-paced era. Comparison is constant. Everything feels instant. And the promise of &quot;easy success&quot; is everywhere.</summary>
            <content type="html">&lt;p&gt;At the end of last year, I turned 30. And with the birthday came that question that tends to show up every so often:
&quot;Am I on the right path?&quot;&lt;/p&gt;

&lt;p&gt;I look around and see a lot of people early in their careers already chasing high positions, high salaries, and status. And when it doesn&#039;t happen fast, the blame falls on the market, on college, on the company... on anything external.&lt;/p&gt;

&lt;p&gt;We live in a fast-paced era. Comparison is constant. Everything feels instant. And the promise of &quot;easy success&quot; is everywhere.&lt;/p&gt;

&lt;p&gt;Today, a new CEO, CTO, or Founder of this or that pops up every day, as if that were the only possible path.&lt;/p&gt;

&lt;p&gt;But let me tell you something: &lt;strong&gt;success is relative.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And no, I&#039;m not saying you need to spend your whole life at the same company, for example.&lt;/p&gt;

&lt;p&gt;Not what you expected? Change it.
Want to work remote and the company doesn&#039;t offer it? Look for another one.
Not feeling valued? Go find somewhere you do.
You&#039;re free to build your own journey, your own way.&lt;/p&gt;

&lt;p&gt;What worries me is that a lot of people are guiding themselves by shortcuts, empty promises, or trying to copy success stories that aren&#039;t theirs.&lt;/p&gt;

&lt;p&gt;And in all that rush, they forget to look inward, to understand their own timing, their own pace.&lt;/p&gt;

&lt;p&gt;I, for example, found out I&#039;m doing fine as an employee. I have quality of life, stable income, and health. That&#039;s enough for me, for now.&lt;/p&gt;

&lt;p&gt;Starting a business can also be amazing, it&#039;s just not a race everyone needs to start at the same time. In my case, it just means respecting my own timing and my own choices, without running over my own path trying to meet expectations that aren&#039;t even mine.&lt;/p&gt;

&lt;p&gt;Maybe I sound conservative to some people. But when I look at my own path, I see something solidly built, with steady growth.&lt;/p&gt;

&lt;p&gt;I&#039;ve been earning my place little by little, at my own pace, and that lets me live in a way that feels good to me.&lt;/p&gt;

&lt;p&gt;In the end, I&#039;ll leave a simple but reflective question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are you building a career with purpose, or just chasing a success that someone told you you should want?&lt;/strong&gt;&lt;/p&gt;
</content>
        </entry>
            <entry>
            <id>https://www.marcosmarcolin.com.br/en/blog/no-discard-attribute-php-8-5-en</id>
            <link type="text/html" rel="alternate" href="https://www.marcosmarcolin.com.br/en/blog/no-discard-attribute-php-8-5-en" />
            <title>Marking return values as important (#[\NoDiscard]) in PHP 8.5</title>
            <published>2025-03-05T00:00:00+00:00</published>
            <updated>2026-11-20T00:00:00+00:00</updated>
            <author>
                <name>Marcos Marcolin</name>
            </author>
            <summary type="html">The #[\NoDiscard] attribute in PHP 8.5, avoid silent failures when ignoring important function and method returns.</summary>
            <content type="html">&lt;h2&gt;🐘💡 RFC: #[\NoDiscard] attribute in PHP 8.5?!&lt;/h2&gt;

&lt;p&gt;A new &lt;strong&gt;RFC currently under vote&lt;/strong&gt; for PHP 8.5 proposes adding the &lt;strong&gt;#[\NoDiscard]&lt;/strong&gt; attribute, which warns when the return value of a function or method isn&#039;t used.&lt;/p&gt;

&lt;h3&gt;⚠️ The problem?&lt;/h3&gt;

&lt;p&gt;Ignoring return values can lead to &lt;strong&gt;silent failures&lt;/strong&gt; that are hard to detect. This RFC aims to make that behavior more explicit and reduce bugs, ensuring important return values are always checked.&lt;/p&gt;

&lt;h3&gt;⚙️ How does it work?&lt;/h3&gt;

&lt;p&gt;If a function is marked with &lt;strong&gt;#[\NoDiscard]&lt;/strong&gt;, PHP will emit a &lt;strong&gt;warning&lt;/strong&gt; whenever its return value is ignored. If the developer wants to &lt;strong&gt;intentionally discard&lt;/strong&gt; the return value, a &lt;strong&gt;(void) cast&lt;/strong&gt; can be used.&lt;/p&gt;

&lt;p&gt;The RFC is still under vote, but it has good chances of being approved.&lt;/p&gt;

&lt;h3&gt;So, would you like this feature?&lt;/h3&gt;

&lt;p&gt;Personally, &lt;strong&gt;yes&lt;/strong&gt;, since its use is optional. Making it mandatory would be crazy, and I believe that will never happen.&lt;/p&gt;

&lt;h2&gt;Practical example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

#[\NoDiscard(&quot;Check the return value to ensure correct processing.&quot;)]
function processItems(array $items): array 
{
    $results = [];

    foreach ($items as $item) {
        $results[] = random_int(0, 1);
    }

    return $results;
}

$items = [&#039;foo&#039;, &#039;bar&#039;, &#039;baz&#039;];

// ⚠️ Warning: The return value of function processItems() is expected to be consumed, Check the return value to ensure correct processing in %s on line %d
processItems($items);

// ✅ No warning, since the return value was used
$results = processItems($items);

// ✅ No warning, since the return value was intentionally discarded
(void) processItems($items);
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Update: approved for PHP 8.5&lt;/h2&gt;

&lt;p&gt;The RFC was approved and the &lt;code&gt;#[\NoDiscard]&lt;/code&gt; attribute is part of PHP 8.5, released on November 20, 2025, together with the &lt;code&gt;(void)&lt;/code&gt; cast. It is covered in my summary of &lt;a href=&quot;/en/blog/php-85-en&quot;&gt;what&#039;s new in PHP 8.5&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Where it makes the biggest difference&lt;/h2&gt;

&lt;p&gt;The example above is didactic, but the attribute really shines in situations where ignoring the return value is an easy mistake to make and a hard one to notice.&lt;/p&gt;

&lt;h3&gt;Immutable objects&lt;/h3&gt;

&lt;p&gt;This is the classic case. In an immutable object, methods like &lt;code&gt;with...()&lt;/code&gt; don&#039;t change the current object, they return a &lt;strong&gt;new instance&lt;/strong&gt;. Anyone who forgets that writes code that looks right but does nothing:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

final class Money
{
    public function __construct(
        public readonly int $amount,
        public readonly string $currency,
    ) {}

    #[\NoDiscard(&#039;Money is immutable, use the returned object.&#039;)]
    public function add(int $amount): self
    {
        return new self($this-&amp;gt;amount + $amount, $this-&amp;gt;currency);
    }
}

$total = new Money(100, &#039;BRL&#039;);

// ⚠️ Warning: the result was discarded and $total is still 100
$total-&amp;gt;add(50);

// ✅ Correct
$total = $total-&amp;gt;add(50);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The same mistake happens often with &lt;code&gt;DateTimeImmutable::modify()&lt;/code&gt;, for example. With the attribute, the bug becomes a warning on the very first run.&lt;/p&gt;

&lt;h3&gt;Functions that signal success or failure through the return value&lt;/h3&gt;

&lt;p&gt;Functions that return &lt;code&gt;false&lt;/code&gt; when something goes wrong, instead of throwing an exception, are another common case. If the return value is ignored, the failure goes unnoticed:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php

#[\NoDiscard(&#039;Check whether the lock was acquired before continuing.&#039;)]
function acquireLock(string $name): bool
{
    // ...
}

if (!acquireLock(&#039;import&#039;)) {
    throw new RuntimeException(&#039;The import is already running.&#039;);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Operation results&lt;/h3&gt;

&lt;p&gt;Methods that return a result object, with validation errors or the status of an operation, are also good candidates. Ignoring that object almost always means ignoring an error.&lt;/p&gt;

&lt;h2&gt;Details of the &lt;code&gt;(void)&lt;/code&gt; cast&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;(void)&lt;/code&gt; cast is the explicit way of saying &quot;I know this function returns something important and I&#039;m discarding it on purpose&quot;. A few points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It can only be used as a standalone statement. You can&#039;t use it in the middle of an expression, as in &lt;code&gt;$x = (void) foo();&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It can be used on any call, even when the function doesn&#039;t have the attribute. In that case, it changes nothing.&lt;/li&gt;
&lt;li&gt;It documents the intent in the code itself: whoever reads it knows the discard was a decision, not an oversight.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Compatibility with older versions&lt;/h2&gt;

&lt;p&gt;Attributes are just metadata. In versions before PHP 8.5, a function marked with &lt;code&gt;#[\NoDiscard]&lt;/code&gt; keeps working normally: the attribute is ignored and no warning is emitted. This lets libraries add the attribute without breaking users who are still on older versions.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;(void)&lt;/code&gt; cast, on the other hand, is new syntax. Using it in code that still needs to run on PHP 8.4 or earlier causes a syntax error. If that&#039;s your case, assigning the return value to an unused variable is the alternative.&lt;/p&gt;

&lt;p&gt;You can read more about the proposal in the official post: &lt;a href=&quot;https://wiki.php.net/rfc/marking_return_value_as_important?utm_source=blog&amp;amp;utm_medium=post&amp;amp;utm_campaign=blog-marcos-marcolin&amp;amp;utm_id=php85&quot;&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What do you think of this new feature? Share your thoughts in the comments!&lt;/p&gt;
</content>
        </entry>
    </feed>
