WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10623 closed defect (bug) (fixed)

wp_kses_decode_entities() calls create_function() each time called

Reported by: mdawaffe Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Optimization Keywords: has-patch commit
Focuses: Cc:

Description

Every time wp_kses_decode_entities() is called, create_function() is called twice.

wp_kses_decode_entities() is called at least once in most KSES calls and once in all clean_url() calls. This can result in hundreds of create_function()s on normal pages and thousands on edge pages.

All these create_function()s eat up memory, which can, in edge cases, cause a fatal memory allocation error.

Since these create_function() calls are not used to generate actual dynamic code, there's no reason they cannot be replaced with hardcoded functions.

Attached.

Attachments (1)

10623.diff (1.2 KB) - added by mdawaffe 5 years ago.

Download all attachments as: .zip

Change History (3)

mdawaffe5 years ago

comment:1 azaozz5 years ago

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

(In [11828]) Do not use lambda functions in wp_kses_decode_entities(), props mdawaffe, fixes #10623

comment:2 Denis-de-Bernardy4 years ago

  • Milestone changed from Unassigned to 2.9
Note: See TracTickets for help on using tickets.