[doc-en] master: Fix simplexml_import_dom, simplexml_load_file and simplexml_load_string pages (#5977)

From: Date: Tue, 20 Oct 2026 20:54:24 +0000
Subject: [doc-en] master: Fix simplexml_import_dom, simplexml_load_file and simplexml_load_string pages (#5977)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23868@lists.php.net to get a copy of this message
Author: qodelicious (qodelicious) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-20T22:54:21+02:00 Commit: https://github.com/php/doc-en/commit/c334a640e0361bba18b861ffe519fbc3faa544a5 Raw diff: https://github.com/php/doc-en/commit/c334a640e0361bba18b861ffe519fbc3faa544a5.diff Fix simplexml_import_dom, simplexml_load_file and simplexml_load_string pages (#5977) Changed paths: M reference/simplexml/functions/simplexml-import-dom.xml M reference/simplexml/functions/simplexml-load-file.xml M reference/simplexml/functions/simplexml-load-string.xml Diff: diff --git a/reference/simplexml/functions/simplexml-import-dom.xml b/reference/simplexml/functions/simplexml-import-dom.xml index 9862b34e1a52..2e5f08e07a11 100644 --- a/reference/simplexml/functions/simplexml-import-dom.xml +++ b/reference/simplexml/functions/simplexml-import-dom.xml @@ -34,12 +34,12 @@ <varlistentry> <term><parameter>class_name</parameter></term> <listitem> - <para> + <simpara> You may use this optional parameter so that <function>simplexml_import_dom</function> will return an object of - the specified class. That class should extend the + the specified class. That class must extend the <type>SimpleXMLElement</type> class. - </para> + </simpara> </listitem> </varlistentry> </variablelist> @@ -59,6 +59,10 @@ Throws a <classname>TypeError</classname> when passed a non-XML or non-HTML <parameter>node</parameter>. </simpara> + <simpara> + Throws a <exceptionname>TypeError</exceptionname> if <parameter>class_name</parameter> + is not <classname>SimpleXMLElement</classname> or a class derived from it. + </simpara> </refsect1> <refsect1 role="changelog"> @@ -101,10 +105,6 @@ <?php $dom = new DOMDocument; $dom->loadXML('<books><book><title>blah</title></book></books>'); -if (!$dom) { - echo 'Error while parsing the document'; - exit; -} $s = simplexml_import_dom($dom); diff --git a/reference/simplexml/functions/simplexml-load-file.xml b/reference/simplexml/functions/simplexml-load-file.xml index e4164f9ca90b..275c1189c9e5 100644 --- a/reference/simplexml/functions/simplexml-load-file.xml +++ b/reference/simplexml/functions/simplexml-load-file.xml @@ -79,9 +79,14 @@ properties containing the data held within the XML document,&return.falseforfailure;. </para> &return.falseproblem; + <simpara> + When <constant>LIBXML_RECOVER</constant> is set in <parameter>options</parameter> + and the input is not empty but no root element can be recovered, an uninitialized + <classname>SimpleXMLElement</classname> is returned instead of &false;. + </simpara> </refsect1> - <refsect1 role="errors"><!-- {{{ --> + <refsect1 role="errors"> &reftitle.errors; <para> Produces an <constant>E_WARNING</constant> error message for each error @@ -94,7 +99,34 @@ afterwards. </para> </tip> - </refsect1><!-- }}} --> + <simpara> + Throws a <exceptionname>ValueError</exceptionname> if <parameter>options</parameter> + does not fit in an <type>int</type>. + </simpara> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>8.0.0</entry> + <entry> + A <exceptionname>ValueError</exceptionname> is now thrown if + <parameter>options</parameter> does not fit in an <type>int</type>. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </refsect1> <refsect1 role="examples"> &reftitle.examples; diff --git a/reference/simplexml/functions/simplexml-load-string.xml b/reference/simplexml/functions/simplexml-load-string.xml index b3b9da19e54e..b4d046cd7696 100644 --- a/reference/simplexml/functions/simplexml-load-string.xml +++ b/reference/simplexml/functions/simplexml-load-string.xml @@ -79,9 +79,14 @@ properties containing the data held within the xml document,&return.falseforfailure;. </para> &return.falseproblem; + <simpara> + When <constant>LIBXML_RECOVER</constant> is set in <parameter>options</parameter> + and the input is not empty but no root element can be recovered, an uninitialized + <classname>SimpleXMLElement</classname> is returned instead of &false;. + </simpara> </refsect1> - <refsect1 role="errors"><!-- {{{ --> + <refsect1 role="errors"> &reftitle.errors; <para> Produces an <constant>E_WARNING</constant> error message for each error @@ -94,7 +99,34 @@ afterwards. </para> </tip> - </refsect1><!-- }}} --> + <simpara> + Throws a <exceptionname>ValueError</exceptionname> if <parameter>options</parameter> + does not fit in an <type>int</type>. + </simpara> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>8.0.0</entry> + <entry> + A <exceptionname>ValueError</exceptionname> is now thrown if + <parameter>options</parameter> does not fit in an <type>int</type>. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </refsect1> <refsect1 role="examples"> &reftitle.examples;

« previous php.doc.cvs (#23868) next »