Skip to content
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

DOMDocument->getElementById returns a new copy each time #2109

Closed
idn2104 opened this issue Mar 20, 2014 · 3 comments
Closed

DOMDocument->getElementById returns a new copy each time #2109

idn2104 opened this issue Mar 20, 2014 · 3 comments

Comments

@idn2104
Copy link
Contributor

idn2104 commented Mar 20, 2014

In zend, the same element is returned each time. However, in hhvm, a new copy of the element is made each time. This leads to the failure of the Symfony/Component/DomCrawler/Tests/FormTest.php::testConstructorHandlesFormAttribute test.

Code:

<?php
$dom = new \DOMDocument();
$dom->loadHTML('
<html>
  <form id="form-1" action="" method="POST">
  </form>
  <form id="form_2" action="" method="POST">
  </form>
</html>');
$form = $dom->getElementById('form_2');
var_dump($form);
$form = $dom->getElementById('form_2');
var_dump($form);

zend:

object(DOMElement)#2 (18) {
  <omitted>
}
object(DOMElement)#2 (18) {
  <omitted>
}

hhvm:

object(DOMElement)#2 (0) {
}
object(DOMElement)#3 (0) {
}

(HHVM doesn't vardump the DOMElements correctly, but the data is there)

@chalet16
Copy link
Contributor

Are you going to work on this? If not, I would like to work on this one.

@fredemmott
Copy link
Contributor

Please feel free, a PR would make us very happy :)

@idn2104
Copy link
Contributor Author

idn2104 commented Mar 20, 2014

Yup, go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants