Hello everyone,

I've noticed an issue in atom feeds; the title seems to be going twice through
`htmlspecialchars`. When the post is saved and when the feed is built, resulting
in odd title like this : "Grsec & snmpd" (source code being "Grsec &
snmpd").

Imho two workarounds are possible, patches are attached.

Have a nice day!

-- 
Benjamin Collet
  ‘Good news, everyone! I've taught the toaster to feel love!’
--- system/classes/atomhandler.php      2009-08-30 13:59:33.000000000 +0200
+++ system/classes/atomhandler.php      2009-08-30 14:00:14.000000000 +0200
@@ -187,7 +187,7 @@
        {
                foreach ( $posts as $post ) {
                        $user = User::get_by_id( $post->user_id );
-                       $title = ( $this->is_auth() ) ? htmlspecialchars( $post->title ) : htmlspecialchars( $post->title_atom );
+                       $title = ( $this->is_auth() ) ? htmlspecialchars( $post->title, ENT_COMPAT, 'UTF-8', false ) : htmlspecialchars( $post->title_atom, ENT_COMPAT, 'UTF-8', false );
                        $content = ( $this->is_auth() ) ? htmlspecialchars( $post->content ) : htmlspecialchars( $post->content_atom );

                        $feed_entry = $xml->addChild( 'entry' );
--- system/classes/atomhandler.php      2009-08-30 13:59:33.000000000 +0200
+++ system/classes/atomhandler.php      2009-08-30 14:00:39.000000000 +0200
@@ -187,7 +187,7 @@
        {
                foreach ( $posts as $post ) {
                        $user = User::get_by_id( $post->user_id );
-                       $title = ( $this->is_auth() ) ? htmlspecialchars( $post->title ) : htmlspecialchars( $post->title_atom );
+                       $title = ( $this->is_auth() ) ? htmlspecialchars( $post->title ) : $post->title_atom;
                        $content = ( $this->is_auth() ) ? htmlspecialchars( $post->content ) : htmlspecialchars( $post->content_atom );

                        $feed_entry = $xml->addChild( 'entry' );

Attachment: signature.asc
Description: Digital signature

Reply via email to