-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SimpleXMLElement::asXML differs from Zend for empty elements #2983
Comments
On it. |
$ cat test.php
<?php
$a = new SimpleXMLElement("<a/>");
$a->addChild('b');
var_dump($a->asXML()); $ ./hphp/hhvm/hhvm test.php
string(34) "<?xml version="1.0"?>
<a><b/></a>
" Try a more recent build? :-) |
It's a LibXML difference. I get the problem with HHVM and libxml2.7.8 though not with PHP and 2.7.8. |
On the same topic, empty($a) yields different results in PHP 5.3 and HHVM 3.3 (libxml2.7.8). @danslo FYI, this affects Magento when configured for separate read-only and read-write databases. In such a configuration, |
@aingram Same topic (SimpleXML), but not same issue... So please create a separate issue that has a small reproduction. |
Done: #3963 |
@danslo can this be closed? |
@paulbiss I don't know, I could never reproduce this (seemed to depend on libxml version). |
Thanks! |
@paulbiss this is still an problem (at least with 3.3.1):
HHVM matches PHP with a later libxml version (whatever Ubuntu 14.04 has), but is different with this one (Ubuntu 12.04) |
I can re-open this as a "build" issue but if the issue is with an external library it's unlikely there will be a fix on our end. |
From what I can tell, it's more an interface issue. PHP and HHVM are using the exact same libxml version, but HHVM has different behaviour |
Did a bit of digging and it appears that it's down to |
This works on the current version of HHVM. https://3v4l.org/BAnGT |
Expected (Zend) output:
Actual output:
The
<b>
is self-closing under Zend but not HHVM. This only seems to happen with nodes added dynamically. If passed as part of the string used during construction, the outputs both have the self-closing tag.// @danslo
The text was updated successfully, but these errors were encountered: