cvs: pear /HTTP_WebDAV_Server/Tools _parse_proppatch.php

From: Date: Mon, 05 Jan 2004 12:41:34 +0000
Subject: cvs: pear /HTTP_WebDAV_Server/Tools _parse_proppatch.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15376@lists.php.net to get a copy of this message
hholzgra Mon Jan 5 07:41:34 2004 EDT Modified files: /pear/HTTP_WebDAV_Server/Tools _parse_proppatch.php Log: the <proppertyupdate> parser had a serious flaw (although it didn't affect the usual use of webdav as just another network filesystem afaict): property values containing XML themselves where mangled during parsing so that they were reduced to the last pieces of data within the property value content this has now been fixed to collect all data within a property value regardless of its format but still assumes that all XML tags within the content are of the same namespace as the top level property tag the lockinfo parser has the same issue when reading <owner> information so this will be fixed in both parser classes later Index: pear/HTTP_WebDAV_Server/Tools/_parse_proppatch.php diff -u pear/HTTP_WebDAV_Server/Tools/_parse_proppatch.php:1.2 pear/HTTP_WebDAV_Server/Tools/_parse_proppatch.php:1.3 --- pear/HTTP_WebDAV_Server/Tools/_parse_proppatch.php:1.2 Mon Jan 5 07:34:42 2004 +++ pear/HTTP_WebDAV_Server/Tools/_parse_proppatch.php Mon Jan 5 07:41:34 2004 @@ -17,7 +17,7 @@ // | Christian Stocker <chregu@bitflux.ch> | // +----------------------------------------------------------------------+ // -// $Id: _parse_proppatch.php,v 1.2 2004/01/05 12:34:42 hholzgra Exp $ +// $Id: _parse_proppatch.php,v 1.3 2004/01/05 12:41:34 hholzgra Exp $ // /** @@ -140,15 +140,26 @@ if ($this->depth == 1) { $this->mode = $tag; - } + } if ($this->depth == 3) { $prop = array("name" => $tag); $this->current = array("name" => $tag, "ns" => $ns, "status"=> 200); - if ($this->mode == "set") + if ($this->mode == "set") { $this->current["val"] = ""; // default set val + } + } + + if ($this->depth >= 4) { + $this->current["val"] .= "<$tag"; + foreach ($attr as $key => $val) { + $this->current["val"] .= ' '.$key.'="'.str_replace('"','&quot;', $val).'"'; + } + $this->current["val"] .= ">"; } + + $this->depth++; } @@ -162,12 +173,27 @@ */ function _endElement($parser, $name) { - if (isset($this->current)) { - $this->props[] = $this->current; - unset($this->current); + if (strstr($name, " ")) { + list($ns, $tag) = explode(" ", $name); + if ($ns == "") + $this->success = false; + } else { + $ns = ""; + $tag = $name; } - + $this->depth--; + + if ($this->depth >= 4) { + $this->current["val"] .= "</$tag>"; + } + + if ($this->depth == 3) { + if (isset($this->current)) { + $this->props[] = $this->current; + unset($this->current); + } + } } /** @@ -180,7 +206,7 @@ */ function _data($parser, $data) { if (isset($this->current)) { - $this->current["val"] = $data; + $this->current["val"] .= $data; } } }

« previous php.pear.cvs (#15376) next »