|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61979 LibXMLError Object property 'message' contains LF at the end of string
Submitted: 2012-05-09 09:23 UTC Modified: 2021-03-16 16:04 UTC
From: piotr at smartwebstudio dot cz Assigned: cmb (profile)
Status: Not a bug Package: *XML functions
PHP Version: 5.3.13 OS: Windows Vista 32bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: piotr at smartwebstudio dot cz
New email:
PHP Version: OS:


 [2012-05-09 09:23 UTC] piotr at smartwebstudio dot cz
From manual page:
Tested on PHP 5.3.0, Apache 2.2.11

LibXMLError Object property 'message' contains LF (ASCII 10) at the end of 
Makes it harder to compare error messages that should be ignored or assign 
translation strings.

Test script:
// 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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-13 18:14 UTC]
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] <>
 [2018-03-14 23:10 UTC]
-Package: XML related +Package: *XML functions
 [2021-03-16 16:04 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-03-16 16:04 UTC]
Well, the LFs are indeed provided by libxml2 already[1], and it
makes no sense to strip them out.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 12:01:29 2024 UTC