Entity errors generating Atom feeds

Posted

After switching to Zend_Feed_Writer for my blog RSS and Atom feeds, I was frequently seeing errors like this in the logs:

PHP Warning:  DOMDocument::loadXML(): Entity 'rsquo' not defined in Entity, line: 14 in /path/to/library/Zend/Feed/Writer/Renderer/Entry/Atom.php on line 393

(the error appeared for several different entities). This happens because entities such as ’ or   are not valid in XML feeds, you need to use their numeric equivalents. Zend_Feed_Writer uses the PHP HTML Tidy extension to perform this conversion if it is available, so you should only see this error if you don't have the extension installed.

You can fix the error simply by installing the extension. On Ubuntu this is as simple as sudo apt-get install php5-tidy. This is covered in ZF ticket #9566, and the discussion indicates it's an area that was flagged for improvement in ZF2.

Comments (0) Tags: zend framework

Add Comment

(Never shown on the site)

(Newlines preserved, format with Markdown)