[DOC-CVS] [doc-en] master: ext/simplexml: Document that get methods and string casts no longer implicitly rewind (#5737)

[email protected] (Louis-Arnaud via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-08-04T10:51:22+02:00

Commit: https://github.com/php/doc-en/commit/418ec505128707215c5c99ad4a66a88bfd84a0ff
Raw diff: https://github.com/php/doc-en/commit/418ec505128707215c5c99ad4a66a88bfd84a0ff.diff

ext/simplexml: Document that get methods and string casts no longer implicitly rewind (#5737)

Changed paths:
  M  reference/simplexml/simplexmlelement.xml
  M  reference/simplexml/simplexmlelement/rewind.xml


Diff:

diff --git a/reference/simplexml/simplexmlelement.xml b/reference/simplexml/simplexmlelement.xml
index 244271b92601..7d901c0388b2 100644
--- a/reference/simplexml/simplexmlelement.xml
+++ b/reference/simplexml/simplexmlelement.xml
@@ -56,6 +56,18 @@
       </row>
      </thead>
      <tbody>
+      <row>
+       <entry>8.4.0</entry>
+       <entry>
+        Get methods (such as
+        <methodname>SimpleXMLElement::asXML</methodname> or
+        <methodname>SimpleXMLElement::getName</methodname>) and casting a
+        <classname>SimpleXMLElement</classname> to a &string; no longer
+        implicitly rewind the iterator.
+        The iterator must now be rewound explicitly, using
+        <methodname>SimpleXMLElement::rewind</methodname>, where needed.
+       </entry>
+      </row>
       <row>
        <entry>8.0.0</entry>
        <entry>
diff --git a/reference/simplexml/simplexmlelement/rewind.xml b/reference/simplexml/simplexmlelement/rewind.xml
index 8caf94997d8f..1a73c2710751 100644
--- a/reference/simplexml/simplexmlelement/rewind.xml
+++ b/reference/simplexml/simplexmlelement/rewind.xml
@@ -22,6 +22,17 @@
   <para>
    This method rewinds the <classname>SimpleXMLElement</classname> to the first element.
   </para>
+
+  <note>
+   <simpara>
+    As of PHP 8.4.0, calling get methods (such as
+    <methodname>SimpleXMLElement::asXML</methodname> or
+    <methodname>SimpleXMLElement::getName</methodname>) or casting a
+    <classname>SimpleXMLElement</classname> to a &string; no longer
+    implicitly rewinds the iterator. Where required, the iterator must be
+    rewound explicitly by calling this method.
+   </simpara>
+  </note>
  </refsect1>
 
  <refsect1 role="parameters">
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.