Make WordPress Core

Opened 8 years ago

Last modified 7 years ago

#15193 closed defect (bug)

get_file_data() regex issue — at Version 7

Reported by: scribu Owned by:
Milestone: 3.1 Priority: lowest
Severity: trivial Version:
Component: Plugins Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

I always wondered how the plugin/theme header syntax could be so permissive.

It turns out the regex is too permissive.

If the description field is missing, for example, it will match any line at the beginning of a file that contains 'description:' in it, such as:


_e('Edit description:');

Change History (9)

#1 @scribu
8 years ago

  • Description modified (diff)

8 years ago

#2 @scribu
8 years ago

  • Keywords has-patch added

8 years ago

example plugin, demonstrating bug

#3 @Denis-de-Bernardy
8 years ago

Couldn't that prevent the following two from working?

# Description: foo

 * Description: foo

#4 @Denis-de-Bernardy
8 years ago


// Description: foo

#5 @filosofo
8 years ago

I've seen a number of plugins with whitespace before each header, as Denis mentions.

If you want to avoid the double colon of a static method, why not use a negative lookahead instead?


#6 @scribu
8 years ago

It's not just static method calls I want to avoid.

Another example of the problem:

_e('Edit description:');

#7 @scribu
8 years ago

  • Description modified (diff)

I always wondered how

Note: See TracTickets for help on using tickets.