Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-22663 Repository: Fixed strict standards notices in WebDAV lib

  • Loading branch information...
commit f515f00aaea7af01f38c053b26c719774d8cbcd7 1 parent f2ddce9
@FMCorz FMCorz authored
Showing with 36 additions and 27 deletions.
  1. +36 −27 lib/webdavlib.php
View
63 lib/webdavlib.php
@@ -57,6 +57,7 @@ class webdav_client {
private $_req;
private $_resp_status;
private $_parser;
+ private $_parserid;
private $_xmltree;
private $_tree;
private $_ls = array();
@@ -612,9 +613,10 @@ function lock($path) {
if (strcmp($response['header']['Content-Type'], 'text/xml; charset="utf-8"') == 0) {
// ok let's get the content of the xml stuff
$this->_parser = xml_parser_create_ns();
+ $this->_parserid = (int) $this->_parser;
// forget old data...
- unset($this->_lock[$this->_parser]);
- unset($this->_xmltree[$this->_parser]);
+ unset($this->_lock[$this->_parserid]);
+ unset($this->_xmltree[$this->_parserid]);
xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
xml_set_object($this->_parser, $this);
@@ -630,8 +632,8 @@ function lock($path) {
// Free resources
xml_parser_free($this->_parser);
// add status code to array
- $this->_lock[$this->_parser]['status'] = 200;
- return $this->_lock[$this->_parser];
+ $this->_lock[$this->_parserid]['status'] = 200;
+ return $this->_lock[$this->_parserid];
} else {
print 'Missing Content-Type: text/xml header in response.<br>';
@@ -709,9 +711,10 @@ function delete($path) {
if (strcmp($response['header']['Content-Type'], 'text/xml; charset="utf-8"') == 0) {
// ok let's get the content of the xml stuff
$this->_parser = xml_parser_create_ns();
+ $this->_parserid = (int) $this->_parser;
// forget old data...
- unset($this->_delete[$this->_parser]);
- unset($this->_xmltree[$this->_parser]);
+ unset($this->_delete[$this->_parserid]);
+ unset($this->_xmltree[$this->_parserid]);
xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
xml_set_object($this->_parser, $this);
@@ -728,8 +731,8 @@ function delete($path) {
// Free resources
xml_parser_free($this->_parser);
- $this->_delete[$this->_parser]['status'] = $response['status']['status-code'];
- return $this->_delete[$this->_parser];
+ $this->_delete[$this->_parserid]['status'] = $response['status']['status-code'];
+ return $this->_delete[$this->_parserid];
} else {
print 'Missing Content-Type: text/xml header in response.<br>';
@@ -800,9 +803,10 @@ function ls($path) {
if (preg_match('#(application|text)/xml;\s?charset=[\'\"]?utf-8[\'\"]?#i', $response['header']['Content-Type'])) {
// ok let's get the content of the xml stuff
$this->_parser = xml_parser_create_ns('UTF-8');
+ $this->_parserid = (int) $this->_parser;
// forget old data...
- unset($this->_ls[$this->_parser]);
- unset($this->_xmltree[$this->_parser]);
+ unset($this->_ls[$this->_parserid]);
+ unset($this->_xmltree[$this->_parserid]);
xml_parser_set_option($this->_parser,XML_OPTION_SKIP_WHITE,0);
xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,0);
// xml_parser_set_option($this->_parser,XML_OPTION_TARGET_ENCODING,'UTF-8');
@@ -819,7 +823,7 @@ function ls($path) {
// Free resources
xml_parser_free($this->_parser);
- $arr = $this->_ls[$this->_parser];
+ $arr = $this->_ls[$this->_parserid];
return $arr;
} else {
$this->_error_log('Missing Content-Type: text/xml header in response!!');
@@ -1035,7 +1039,8 @@ function mget($filelist) {
private function _endElement($parser, $name) {
// end tag was found...
- $this->_xmltree[$parser] = substr($this->_xmltree[$parser],0, strlen($this->_xmltree[$parser]) - (strlen($name) + 1));
+ $parserid = (int) $parser;
+ $this->_xmltree[$parserid] = substr($this->_xmltree[$parserid],0, strlen($this->_xmltree[$parserid]) - (strlen($name) + 1));
}
/**
@@ -1050,19 +1055,20 @@ private function _endElement($parser, $name) {
*/
private function _propfind_startElement($parser, $name, $attrs) {
// lower XML Names... maybe break a RFC, don't know ...
+ $parserid = (int) $parser;
$propname = strtolower($name);
- if (!empty($this->_xmltree[$parser])) {
- $this->_xmltree[$parser] .= $propname . '_';
+ if (!empty($this->_xmltree[$parserid])) {
+ $this->_xmltree[$parserid] .= $propname . '_';
} else {
- $this->_xmltree[$parser] = $propname . '_';
+ $this->_xmltree[$parserid] = $propname . '_';
}
// translate xml tree to a flat array ...
- switch($this->_xmltree[$parser]) {
+ switch($this->_xmltree[$parserid]) {
case 'dav::multistatus_dav::response_':
// new element in mu
- $this->_ls_ref =& $this->_ls[$parser][];
+ $this->_ls_ref =& $this->_ls[$parserid][];
break;
case 'dav::multistatus_dav::response_dav::href_':
$this->_ls_ref_cdata = &$this->_ls_ref['href'];
@@ -1110,7 +1116,7 @@ private function _propfind_startElement($parser, $name, $attrs) {
default:
// handle unknown xml elements...
- $this->_ls_ref_cdata = &$this->_ls_ref[$this->_xmltree[$parser]];
+ $this->_ls_ref_cdata = &$this->_ls_ref[$this->_xmltree[$parserid]];
}
}
@@ -1145,14 +1151,15 @@ private function _propfind_cData($parser, $cdata) {
*/
private function _delete_startElement($parser, $name, $attrs) {
// lower XML Names... maybe break a RFC, don't know ...
+ $parserid = (int) $parser;
$propname = strtolower($name);
- $this->_xmltree[$parser] .= $propname . '_';
+ $this->_xmltree[$parserid] .= $propname . '_';
// translate xml tree to a flat array ...
- switch($this->_xmltree[$parser]) {
+ switch($this->_xmltree[$parserid]) {
case 'dav::multistatus_dav::response_':
// new element in mu
- $this->_delete_ref =& $this->_delete[$parser][];
+ $this->_delete_ref =& $this->_delete[$parserid][];
break;
case 'dav::multistatus_dav::response_dav::href_':
$this->_delete_ref_cdata = &$this->_ls_ref['href'];
@@ -1160,7 +1167,7 @@ private function _delete_startElement($parser, $name, $attrs) {
default:
// handle unknown xml elements...
- $this->_delete_cdata = &$this->_delete_ref[$this->_xmltree[$parser]];
+ $this->_delete_cdata = &$this->_delete_ref[$this->_xmltree[$parserid]];
}
}
@@ -1196,8 +1203,9 @@ private function _delete_cData($parser, $cdata) {
*/
private function _lock_startElement($parser, $name, $attrs) {
// lower XML Names... maybe break a RFC, don't know ...
+ $parserid = (int) $parser;
$propname = strtolower($name);
- $this->_xmltree[$parser] .= $propname . '_';
+ $this->_xmltree[$parserid] .= $propname . '_';
// translate xml tree to a flat array ...
/*
@@ -1206,10 +1214,10 @@ private function _lock_startElement($parser, $name, $attrs) {
dav::prop_dav::lockdiscovery_dav::activelock_dav::timeout_=
dav::prop_dav::lockdiscovery_dav::activelock_dav::locktoken_dav::href_=
*/
- switch($this->_xmltree[$parser]) {
+ switch($this->_xmltree[$parserid]) {
case 'dav::prop_dav::lockdiscovery_dav::activelock_':
// new element
- $this->_lock_ref =& $this->_lock[$parser][];
+ $this->_lock_ref =& $this->_lock[$parserid][];
break;
case 'dav::prop_dav::lockdiscovery_dav::activelock_dav::locktype_dav::write_':
$this->_lock_ref_cdata = &$this->_lock_ref['locktype'];
@@ -1235,7 +1243,7 @@ private function _lock_startElement($parser, $name, $attrs) {
break;
default:
// handle unknown xml elements...
- $this->_lock_cdata = &$this->_lock_ref[$this->_xmltree[$parser]];
+ $this->_lock_cdata = &$this->_lock_ref[$this->_xmltree[$parserid]];
}
}
@@ -1251,8 +1259,9 @@ private function _lock_startElement($parser, $name, $attrs) {
* @access private
*/
private function _lock_cData($parser, $cdata) {
+ $parserid = (int) $parser;
if (trim($cdata) <> '') {
- // $this->_error_log(($this->_xmltree[$parser]) . '='. htmlentities($cdata));
+ // $this->_error_log(($this->_xmltree[$parserid]) . '='. htmlentities($cdata));
$this->_lock_ref_cdata .= $cdata;
} else {
// do nothing
Please sign in to comment.
Something went wrong with that request. Please try again.