Make WordPress Core

Opened 9 years ago

Last modified 3 years ago

#33563 new defect (bug)

Multiple Calls to export_wp() Causes Error

Reported by: drzaphod's profile drzaphod Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.3
Component: Export Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The "export_wp" function in "wp-admin/includes/export.php" makes use of inner functions that cause a "previously declared" error when this function is called more than once.

These inner functions should be declared outside of the "export_wp" function or guarded by, for example, if(!function_exists('wxr_cdata')){}

I am trying to make use of this function to perform multiple exports per script execution as part of a MU user management system.

<feature request>
It would also be help to have the option of saving the export to a function parameter by reference rather than the screen.
</feature request>

Attachments (3)

wordpress-develop.33563.diff (45.3 KB) - added by screamingdev 8 years ago.
Put wxr_* function in separate file
wordpress-develop.33563.2.diff (45.9 KB) - added by screamingdev 8 years ago.
Swap wxr_* functions and for testing comments_open needed to be fixed in case of wrong post ID's
wordpress-develop.33563.3.diff (14.6 KB) - added by screamingdev 8 years ago.
Swap wxr_* functions within same file out of function and for testing comments_open needed to be fixed in case of wrong post ID's

Download all attachments as: .zip

Change History (9)

#2 @screamingdev
8 years ago

  • Keywords has-patch added

Here is a patch with test, that puts the wxr_* function in a separate file.
The export_wp() function requires that file once.

@screamingdev
8 years ago

Put wxr_* function in separate file

This ticket was mentioned in Slack in #core by screamingdev. View the logs.


8 years ago

@screamingdev
8 years ago

Swap wxr_* functions and for testing comments_open needed to be fixed in case of wrong post ID's

#4 @swissspidy
8 years ago

  • Keywords needs-refresh added

A few notes on the patch:

  • __DIR__ is not available in PHP 5.2
  • You're missing the wxr.php file you created in the patch. There's no need for this file though, just add these functions at the bottom of export.php.

@screamingdev
8 years ago

Swap wxr_* functions within same file out of function and for testing comments_open needed to be fixed in case of wrong post ID's

#5 @screamingdev
8 years ago

  • Keywords needs-refresh removed

#6 @swissspidy
7 years ago

  • Keywords has-unit-tests added
  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.