Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#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:


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 5 years ago.

Download all attachments as: .zip

Change History (5)

5 years ago

#1 @kovshenin
5 years ago

  • Keywords has-patch added

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

#2 @SergeyBiryukov
5 years ago

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

#3 @nacin
5 years ago

In 24129:

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

props kovshenin.
see #24222.

#4 @nacin
5 years 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.