[DOC-CVS] [doc-en] master: language: document the PHP 8.4 comparison and readonly clone BC breaks (#5775)

[email protected] (Louis-Arnaud via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-21T16:26:39+02:00

Commit: https://github.com/php/doc-en/commit/62e61e543c2d2b8519952efa246ed708026cfb16
Raw diff: https://github.com/php/doc-en/commit/62e61e543c2d2b8519952efa246ed708026cfb16.diff

language: document the PHP 8.4 comparison and readonly clone BC breaks (#5775)

* language: document the PHP 8.4 comparison and readonly clone BC breaks

* Update comparison.xml

Co-authored-by: Jordi Kroon <[email protected]>

---------

Co-authored-by: Jordi Kroon <[email protected]>

Changed paths:
  M  language/oop5/properties.xml
  M  language/operators/comparison.xml


Diff:

diff --git a/language/oop5/properties.xml b/language/oop5/properties.xml
index 9fc60965ea20..a40df2528bab 100644
--- a/language/oop5/properties.xml
+++ b/language/oop5/properties.xml
@@ -361,6 +361,14 @@ var_dump($test2->prop); // NULL
      </programlisting>
     </example>
    </para>
+   <note>
+    <simpara>
+     As of PHP 8.4.0, indirect modification of a readonly property within
+     <link linkend="object.clone">__clone()</link>, such as acquiring a
+     reference to it (<code>$ref = &amp;$this->prop</code>), is no longer
+     allowed. This was already forbidden during readonly initialization.
+    </simpara>
+   </note>
   </sect2>
 
   <sect2 xml:id="language.oop5.properties.dynamic-properties">
diff --git a/language/operators/comparison.xml b/language/operators/comparison.xml
index 44c6a491ad4d..b8f8a061d44d 100644
--- a/language/operators/comparison.xml
+++ b/language/operators/comparison.xml
@@ -330,6 +330,15 @@ function standard_array_compare($op1, $op2)
   </simpara>
  </note>
 
+ <note>
+  <simpara>
+   Encountering recursion during comparison, for example when comparing an
+   array or object that contains a reference to itself, throws an
+   <exceptionname>Error</exceptionname> as of PHP 8.4.0; previously,
+   it resulted in a fatal error.
+  </simpara>
+ </note>
+
  <sect2 xml:id="language.operators.comparison.incomparable">
   <title>Incomparable Values</title>
   <simpara>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.