From a30dde136727c4233047d7ddbc625160f418d540 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Wed, 21 Oct 2026 09:31:37 +0200 Subject: [PATCH] [Sync-En] simplexml: document load/import errors and the LIBXML_RECOVER return case --- .../functions/simplexml-import-dom.xml | 16 +++---- .../functions/simplexml-load-file.xml | 42 ++++++++++++++++--- .../functions/simplexml-load-string.xml | 38 +++++++++++++++-- 3 files changed, 80 insertions(+), 16 deletions(-) diff --git a/reference/simplexml/functions/simplexml-import-dom.xml b/reference/simplexml/functions/simplexml-import-dom.xml index 0d307673f8..80a5326624 100644 --- a/reference/simplexml/functions/simplexml-import-dom.xml +++ b/reference/simplexml/functions/simplexml-import-dom.xml @@ -1,5 +1,5 @@ - + @@ -38,12 +38,12 @@ class_name - + Este parámetro opcional permite que - simplexml_load_string retorne un objeto + simplexml_import_dom retorne un objeto de la clase especificada. Esta clase debe extender la clase SimpleXMLElement. - + @@ -63,6 +63,10 @@ Lanza una TypeError cuando un node no-XML o no-HTML es pasado. + + Lanza una TypeError si class_name + no es SimpleXMLElement o una clase derivada de ella. + @@ -105,10 +109,6 @@ loadXML('blah'); -if (!$dom) { - echo 'Error durante el análisis del documento'; - 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 e3fe5fe582..77369c3160 100644 --- a/reference/simplexml/functions/simplexml-load-file.xml +++ b/reference/simplexml/functions/simplexml-load-file.xml @@ -1,5 +1,5 @@ - + @@ -66,7 +66,7 @@ &true; si namespace_or_prefix es un prefijo, - &false; si es la URI; por omisión, &false;. + &false; si es la URI; por defecto, &false;. @@ -81,9 +81,14 @@ cuyas propiedades contienen los datos del documento XML, &return.falseforfailure;. &return.falseproblem; + + Cuando LIBXML_RECOVER está establecido en options + y la entrada no está vacía pero no se puede recuperar ningún elemento raíz, + se devuelve un SimpleXMLElement no inicializado en lugar de &false;. + - + &reftitle.errors; Genera un mensaje de error de nivel E_WARNING @@ -96,7 +101,34 @@ libxml_get_errors para recorrerlos. - + + Se lanza una ValueError si options + no cabe en un int. + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.0.0 + + Ahora se lanza una ValueError si + options no cabe en un int. + + + + + + &reftitle.examples; @@ -114,7 +146,7 @@ if (file_exists('examples/book.xml')) { print_r($xml); } else { - exit('Fallo al abrir el fichero examples/test.xml.'); + exit('Fallo al abrir el fichero examples/book.xml.'); } ?> ]]> diff --git a/reference/simplexml/functions/simplexml-load-string.xml b/reference/simplexml/functions/simplexml-load-string.xml index 23565c9c48..f822a0f6a5 100644 --- a/reference/simplexml/functions/simplexml-load-string.xml +++ b/reference/simplexml/functions/simplexml-load-string.xml @@ -1,5 +1,5 @@ - + @@ -81,9 +81,14 @@ cuyas propiedades contienen los datos del documento XML, &return.falseforfailure;. &return.falseproblem; + + Cuando LIBXML_RECOVER está establecido en options + y la entrada no está vacía pero no se puede recuperar ningún elemento raíz, + se devuelve un SimpleXMLElement no inicializado en lugar de &false;. + - + &reftitle.errors; Produce un mensaje de error de nivel E_WARNING @@ -96,7 +101,34 @@ libxml_get_errors para recorrerlos. - + + Se lanza una ValueError si options + no cabe en un int. + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.0.0 + + Ahora se lanza una ValueError si + options no cabe en un int. + + + + + + &reftitle.examples;