WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#10836 closed defect (bug) (fixed)

Several Importers call create_function() multiple times per imported post

Reported by: mdawaffe Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: Import Keywords: has-patch needs-testing
Focuses: Cc:

Description

The WordPress, Blogger, Blogware, LiveJournal, and RSS importers all call create_function() one or more times per post.

Importing a lot of posts means creating a lot of functions, all of which do the same thing. This can lead to fatal memory allocation errors.

Attached replaces each create_function() call with a hardcoded function.

Patch in UNTESTED.

Attachments (1)

10836.diff (7.9 KB) - added by mdawaffe 6 years ago.

Download all attachments as: .zip

Change History (6)

@mdawaffe6 years ago

comment:1 @ryan6 years ago

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

(In [11964]) Use hard-coded functions instead of create_function() in importers. Props mdawaffe. fixes #10836

comment:2 @hakre6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

ryan, please see the parameter is called $matches but you use $match later on. this is a minor bug I assume by copy/paste. please fix it.

 	532	    function _normalize_tag( $matches ) { 
 	533	        return '<' . strtolower( $match[1] ); 
 	534	    } 

comment:3 @hakre6 years ago

okay it's mdawaffe code, don't want to give false credits here.

comment:4 @hakre6 years ago

  • Status changed from reopened to reviewing

the problem is in the patch mulitple times. just change the _normalize_tag() function.

idea: what about having one parent import class that provides functions for all the importers which do only extend from that class.

comment:5 @nacin6 years ago

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

Has been fixed in [12104].

Note: See TracTickets for help on using tickets.