Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#9336 closed task (blessed) (fixed)

E_NOTICE undefined offset in wp-includes/theme.php

Reported by: Mittineague Owned by:
Priority: lowest Milestone: 2.8
Component: Themes Version: 2.7.1
Severity: trivial Keywords: has-patch theme
Cc: Focuses:

Description

With my Error Reporting plugin I get

E_NOTICE
Undefined offset: 1 at /home/mittineague/mittineague.com/blog/wp-includes/theme.php (212)
timed at 15-Mar-2009 01:53:41

eg. (several similar lines)

{{{if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )

$author_uri = clean_url( trim( $author_uri[1]) );}}}

preg_match returns FALSE upon an error, or 0 or 1 $matches found. It is possible for no $matches to be found causing $matches[1] to be undefined using the conditional if ( preg_match() )

Attachments (1)

missing_theme_lines.9336.diff (1.6 KB ) - added by filosofo 18 years ago.

Download all attachments as: .zip

Change History (5)

#1 @Mittineague
18 years ago

  • Cc Mittineague added

#2 follow-up: @DD32
18 years ago

Changing the regex's to (.+) should fix this possibility?

#3 in reply to: ↑ 2 @filosofo
18 years ago

  • Keywords has-patch theme added
  • Milestone Unassigned2.8

Replying to DD32:

Changing the regex's to (.+) should fix this possibility?

No, because if you had for example just "Theme URI:" the parentheses would capture nothing and put it in $theme_uri[1], avoiding the undefined notice. This happens when there's no Theme URI line whatsoever; the preg_match returns false, but later on the $theme_uri[1] is used.

#4 @azaozz
18 years ago

  • Resolutionfixed
  • Status newclosed

(In [10825]) Fix notice in wp-includes/theme.php, props filosofo, fixes #9336

Note: See TracTickets for help on using tickets.