Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* added check for url as filename

* added check for no results when sorting


git-svn-id: http://svn.php.net/repository/pear/packages/XML_XPath/trunk@112142 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 3fcb19d268936ac9cff7548251199c3fe80255db 1 parent f65befd
Daniel Allen authored
Showing with 4 additions and 4 deletions.
  1. +1 −1  XPath.php
  2. +3 −3 XPath/result.php
View
2  XPath.php
@@ -130,7 +130,7 @@ function load($in_xml, $in_type = 'string')
$this->xml = $in_xml;
}
// we can read the file, so use xmldocfile to make a xmldom object
- elseif ($in_type == 'file' && @file_exists($in_xml)) {
+ elseif ($in_type == 'file' && (preg_match(';(https?|ftp)://;', $in_xml) || @file_exists($in_xml))) {
$this->xml = domxml_open_file($in_xml);
}
// this is a string, so attempt to make an xmldom object from string
View
6 XPath/result.php
@@ -197,13 +197,13 @@ function getIndex()
* XML_XPATH_SORT_NATURAL_[DE|A]SCENDING
*
* @access public
- * @return boolean success {or XML_XPath_Error exception}
+ * @return boolean success (return false if nothing to sort)
*/
function sort($in_sortXpath = '.', $in_order = XML_XPATH_SORT_TEXT_ASCENDING, $in_permanent = false)
{
// make sure we are dealing with a result that is a nodeset
- if ($this->type != XPATH_NODESET) {
- return PEAR::raiseError(null, XML_XPATH_INVALID_NODESET, null, E_USER_NOTICE, $this->data, 'XPath_Error', true);
+ if ($this->type != XPATH_NODESET || !$this->numResults()) {
+ return false;
}
$data = array();
Please sign in to comment.
Something went wrong with that request. Please try again.