Guest User

Untitled

a guest
Jan 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Index: ext/simplexml/tests/008.phpt
  2. ===================================================================
  3. --- ext/simplexml/tests/008.phpt (revision 315865)
  4. +++ ext/simplexml/tests/008.phpt (working copy)
  5. @@ -25,7 +25,10 @@
  6. $sxe = simplexml_load_string($xml);
  7.  
  8. var_dump($sxe->xpath("elem1/elem2/elem3/elem4"));
  9. +//valid expression
  10. var_dump($sxe->xpath("***"));
  11. +//invalid expression
  12. +var_dump($sxe->xpath("**"));
  13. ?>
  14. --EXPECTF--
  15. array(1) {
  16. @@ -36,4 +39,10 @@
  17. }
  18. }
  19. }
  20. +array(0) {
  21. +}
  22. +
  23. +Warning: SimpleXMLElement::xpath(): Invalid expression in %s on line %d
  24. +
  25. +Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in %s on line %d
  26. bool(false)
  27. Index: ext/simplexml/simplexml.c
  28. ===================================================================
  29. --- ext/simplexml/simplexml.c (revision 315865)
  30. +++ ext/simplexml/simplexml.c (working copy)
  31. @@ -1294,8 +1294,9 @@
  32.  
  33. result = retval->nodesetval;
  34.  
  35. + array_init(return_value);
  36. +
  37. if (result != NULL) {
  38. - array_init(return_value);
  39. for (i = 0; i < result->nodeNr; ++i) {
  40. nodeptr = result->nodeTab[i];
  41. if (nodeptr->type == XML_TEXT_NODE || nodeptr->type == XML_ELEMENT_NODE || nodeptr->type == XML_ATTRIBUTE_NODE) {
  42. @@ -1316,8 +1317,6 @@
  43. add_next_index_zval(return_value, value);
  44. }
  45. }
  46. - } else {
  47. - RETVAL_FALSE;
  48. }
  49.  
  50. xmlXPathFreeObject(retval);
Add Comment
Please, Sign In to add comment