WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#14245 closed defect (bug) (duplicate)

Remove create_function from preg_replace_callback to improve memory usage

Reported by: nacin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Performance Keywords: has-patch
Focuses: Cc:
PR Number:

Description

On large imports, a create_function() call in wp_kses_split() in particular causes memory issues pretty quickly.

Let's continue to move away from create_function calls as callbacks. Patch attached handles most instances.

Attachments (3)

14245.diff (3.4 KB) - added by nacin 9 years ago.
blog-now-news.diff (3.0 KB) - added by nacin 9 years ago.
14245.patch (711 bytes) - added by hakre 9 years ago.

Download all attachments as: .zip

Change History (8)

@nacin
9 years ago

@nacin
9 years ago

#1 @hakre
9 years ago

Maybe using a static function does the job as well and saving the global namespace function starting with subjective stuff like funky? Not that I like create_function that much, but well, it was in use anyway and it's for this callback only.

Second patch looks being an upload in error.

@hakre
9 years ago

#2 @hakre
9 years ago

Just added a patch that solves the reported memory issue. Compared to Nacins suggestion it does not re-introduced an already deprecated function (!) nor does it change the existing function header of wp_kses_split2().

#3 @hakre
9 years ago

Memory Related: #13847

#4 @nacin
9 years ago

  • Milestone changed from Awaiting Review to 3.1

I don't have a problem with re-introducing a function I myself deprecated. It serves its original purpose. Why not?

#5 @nacin
9 years ago

  • Milestone 3.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Both handled elsewhere.

Note: See TracTickets for help on using tickets.