Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10836 closed defect (bug) (fixed)

Several Importers call create_function() multiple times per imported post

Reported by: mdawaffe's profile 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 15 years ago.

Download all attachments as: .zip

Change History (6)

@mdawaffe
15 years ago

#1 @ryan
15 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

#2 @hakre
15 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	    } 

#3 @hakre
15 years ago

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

#4 @hakre
15 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.

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