WordPress.org

Make WordPress Core

#24222 closed enhancement (fixed)

No need to define $matches when using preg_match and preg_match_all

Reported by: kovshenin Owned by: nacin
Milestone: 3.6 Priority: low
Severity: minor Version:
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

I noticed that some of the new code in 3.6, especially around post formats, defines an empty $matches variable when using preg_match and preg_match_all. This is not required and we don't do it in a lot of other places in core.

Attachments (1)

24222.diff (5.0 KB) - added by kovshenin 15 months ago.

Download all attachments as: .zip

Change History (5)

kovshenin15 months ago

comment:1 kovshenin15 months ago

  • Keywords has-patch added

Went through all the codebase in search of these (except external libraries), my findings are in 24222.diff.

comment:2 SergeyBiryukov15 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.6

comment:3 nacin15 months ago

In 24129:

Variables passed by reference do not need to be set first.

props kovshenin.
see #24222.

comment:4 nacin15 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 24130:

Better logic for preg_match() calls in ms-functions.php. fixes #24222.

Note: See TracTickets for help on using tickets.