Opened 10 years ago
Last modified 4 years ago
#33563 new defect (bug)
Multiple Calls to export_wp() Causes Error
Reported by: |
|
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)
Change History (9)
#2
@
9 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.
This ticket was mentioned in Slack in #core by screamingdev. View the logs.
9 years ago
@
9 years ago
Swap wxr_* functions and for testing comments_open needed to be fixed in case of wrong post ID's
#4
@
9 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 ofexport.php
.
Related: #19864, #22435.