Bug #61979 [Opn->Nab]: LibXMLError Object property 'message' contains LF at the end of string
| From: | cmb@php.net | Date: | Tue, 16 Mar 2021 16:04:19 +0000 |
| Subject: | Bug #61979 [Opn->Nab]: LibXMLError Object property 'message' contains LF at the end of string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232789@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61979&edit=1
ID: 61979
Updated by: cmb@php.net
Reported by: piotr at smartwebstudio dot cz
Summary: LibXMLError Object property 'message' contains LF at
the end of string
-Status: Open
+Status: Not a bug
Type: Bug
Package: *XML functions
Operating System: Windows Vista 32bit
PHP Version: 5.3.13
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Well, the LFs are indeed provided by libxml2 already[1], and it
makes no sense to strip them out.
[1] <https://github.com/GNOME/libxml2/blob/868e49cffdbfddeab0d1c391e0ce7f4f98ea59a1/parser.c#L9289>
Previous Comments:
------------------------------------------------------------------------
[2016-06-13 18:14:44] cmb@php.net
In my opinion this is not a bug, as I understand the error message
as "human-readable informative error message"[1]. And I would
rather check for the error code to avoid issues due to libxml
changing the error messages or localization issues.
[1] <http://www.xmlsoft.org/html/libxml-xmlerror.html#xmlError>
------------------------------------------------------------------------
[2012-05-09 09:23:04] piotr at smartwebstudio dot cz
Description:
------------
---
From manual page: http://www.php.net/manual/pl/function.libxml-get-last-error.php
---
Tested on PHP 5.3.0, Apache 2.2.11
LibXMLError Object property 'message' contains LF (ASCII 10) at the end of
string.
Makes it harder to compare error messages that should be ignored or assign
translation strings.
Test script:
---------------
libxml_use_internal_errors(true);
// Define xml string that contains known error
$vcard = new SimpleXMLElement("<vCard xmlns='vcard-temp'></vcard>");
// Retrieve last LibXMLError object
$last_error = libxml_get_last_error();
// Should be true
var_dump($last_error->message == "xmlns: URI vcard-temp is not absolute");
// Workaround
var_dump(trim($last_error->message) == "xmlns: URI vcard-temp is not absolute");
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
bool(false)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61979&edit=1