php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67507 Attribute namespace retrieval
Submitted: 2014-06-24 15:54 UTC Modified: 2014-06-24 17:31 UTC
From: akos dot toth at cheppers dot com Assigned:
Status: Wont fix Package: SimpleXML related
PHP Version: 5.5.13 OS: Ubuntu 14.04 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
34 - 17 = ?
Subscribe to this entry?

 
 [2014-06-24 15:54 UTC] akos dot toth at cheppers dot com
Description:
------------
Why? There is literally no reason for the case highlighted in the test script to not produce the expected output. This is supposed to be simple xml, not overly complicated and utterly useless for even parsing (not to mention creating) xml structures.

Test script:
---------------
$object = simplexml_load_string('<root><base xml:lang="en" /></root>');
print('U' . $object->base->attributes('http://www.w3.org/XML/1998/namespace')->lang);
print('X' . $object->base->attributes('xml')->lang);

Expected result:
----------------
Prints "UenXen" (both methods work for retrieving the attribute).

Actual result:
--------------
Prints "UenX" (simply making the referenced namespace 'xml' does not work, instead I have to add that goddamn bloated URL).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-24 17:31 UTC] requinix@php.net
-Status: Open +Status: Wont fix
 [2014-06-24 17:31 UTC] requinix@php.net
There is documentation for a reason.

http://www.php.net/manual/en/simplexmlelement.attributes.php

print('X' . $object->base->attributes('xml', true)->lang);
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Mar 07 03:01:23 2021 UTC