[wp-trac] [WordPress Trac] #4390: trackback_rdf() bug

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 1 17:12:24 GMT 2007


#4390: trackback_rdf() bug
----------------------+-----------------------------------------------------
 Reporter:  Otto42    |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  normal    |   Milestone:  2.3      
Component:  Template  |     Version:  2.2.1    
 Severity:  major     |    Keywords:           
----------------------+-----------------------------------------------------
 Line 242 of comments-template.php:
 {{{
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) {
 }}}

 Should be this:
 {{{
 if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
 }}}

 Purpose of this code appears to be to not output the rdf code if the W3C
 validator is the one looking. But it's doing the opposite:

 If the validator is looking at the code, the user agent will have the
 validator string in it. So strpos($_SERVER['HTTP_USER_AGENT'],
 'W3C_Validator') will return a number, which is !== false, meaning that
 statement is true, meaning that it outputs the RDF code. This is the
 reverse of the intended outcome.

 The original code also has the problem of case sensitivity, which cannot
 be assured always. If we do want to be case sensitive, then the statement
 should be this:
 {{{
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') == false) {
 }}}

 Bug has been noted in these forum threads: [[BR]]
 http://wordpress.org/support/topic/118168 [[BR]]
 http://wordpress.org/support/topic/119698

 Suggest fix be made to both trunk and 2.2.whatever_is_next.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4390>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list