SimplePie 1.2: ‘This XML document is invalid, likely due to invalid characters. XML error: Undeclared entity warning at line…’
10 02 2011Misstepped on this issue whilst attempting to conjure up a feed with a query string such as blabla.php?foo=bar.
The error message title-mentioned may actually be the conclusion of different conditions, so the following may or may not be applicable for you.
The ‘=’ char in the query string is converted to ‘%3D’ by SimplePie_IRI::replace_invalid_with_pct_encoding(); dunno whether the feed provider should accept PCT encoded query string, but it fails miserably in my situation nonetheless. So added ‘=’ in the list of authorized chars in SimplePie_IRI::replace_invalid_with_pct_encoding() invocation in SimplePie_IRI::set_query(), just as it is already done in SimplePie_IRI::set_host() and SimplePie_IRI::set_path().
Here attached the according patch.
--- simplepie.inc.old 2011-02-10 12:53:00.000000000 +0100 +++ simplepie.inc 2011-02-10 12:53:17.000000000 +0100 @@ -12151,7 +12151,7 @@ } else { - $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$\'()*+,;:@/?'); + $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$\'()*+,;:@/?='); } $this->valid[__FUNCTION__] = true; return true;