Re: AW: [PEAR-DEV] more on XML_Serialize/Unserialize
| From: | Marshall Roch | Date: | Wed, 27 Aug 2003 23:11:13 +0000 |
| Subject: | Re: AW: [PEAR-DEV] more on XML_Serialize/Unserialize | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20692@lists.php.net to get a copy of this message | ||
Stephan Schmidt wrote:
Oh, I'm sorry. I'll fix this in the next release. BTW, you could have taken a look at the function defintion, the documentation there is correct...That's how I figured it out :)
// see if it's an absolute URL (has a scheme at the beginning) elseif (eregi('://', substr($fp, 0, 10))) { return $this->setInputFile($fp); Imagine an XML document like this: <a>ftp://pear.php.net</a> [snip]
Although this looks silly, it will totally break the parsing of the XML string. I don't think that it's a good idea to let a script guess whether a string is a XML document or a URL.I agree that a better regex is needed there. I didn't want to have it check for certain protocols in case something new or unknown to me came along. eregi('^[a-z]+://', substr($fp, 0, 10)) Does that look better? It wouldn't match any valid XML string, even if there was a comment at the top or something. -- Marshall Roch