WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4390 closed defect (bug) (fixed)

trackback_rdf() bug

Reported by: Otto42 Owned by: rob1n
Milestone: 2.2.1 Priority: normal
Severity: major Version: 2.2
Component: Template Keywords:
Focuses: Cc:

Description

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($_SERVERHTTP_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:
http://wordpress.org/support/topic/118168
http://wordpress.org/support/topic/119698

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

Change History (6)

comment:1 Otto427 years ago

Additional: This bug was introduced in [4990] for ticket #3920.

comment:2 rob1n7 years ago

  • Owner changed from anonymous to rob1n
  • Status changed from new to assigned

comment:3 rob1n7 years ago

  • Milestone changed from 2.3 to 2.2.1
  • Version changed from 2.2.1 to 2.2

comment:4 rob1n7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5626]) Fix a strpos typo. fixes #4390

comment:5 markjaquith7 years ago

(In [6039]) Deprecate option_can_override, option_type, option_width, option_height, option_description, option_admin_level from options table. Props Nazgul. fixes #4390

comment:6 markjaquith7 years ago

Dangit -- That last message was for #4398

Note: See TracTickets for help on using tickets.