Make WordPress Core

Opened 3 years ago

Last modified 3 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)

comment:1 scribu3 years ago

  • Description modified (diff)

scribu3 years ago

comment:2 scribu3 years ago

  • Keywords has-patch added

scribu3 years ago

example plugin, demonstrating bug

comment:3 Denis-de-Bernardy3 years ago

Couldn't that prevent the following two from working?

# Description: foo

 * Description: foo

comment:4 Denis-de-Bernardy3 years ago


// Description: foo

comment:5 filosofo3 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?


comment:6 scribu3 years ago

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

Another example of the problem:

_e('Edit description:');

comment:7 scribu3 years ago

  • Description modified (diff)

I always wondered how

Note: See TracTickets for help on using tickets.