Make WordPress Core

Opened 8 years ago

Last modified 6 years ago

#34798 new defect (bug)

Export Bug

Reported by: eugenekireev's profile eugenekireev Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Export Keywords: has-patch dev-feedback needs-refresh
Focuses: Cc:

Description

We found a bug in export process that prevents post data changes going to actual export.
In wp\wp-admin\includes\export.php L416 you select all matching posts from DB, having $posts array of stdClass objects as result. Then you call setup_postdata for every post, that goes to wp\wo-includes\query.php setup_postdata which calls $wp_query->setup_postdata after passing the $post.
In function setup_postdata L4754 you check instance of the $post which will always be stdClass and create a new $post object. It breaks the reference link original $post from export.php so all changes in function setup_postdata will not be reflected to original object.

A possible fix would be converting $post object to WP_Post before calling setup_postdata in expost.php Please see patch attached

Attachments (1)

export.php.patch (287 bytes) - added by eugenekireev 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
8 years ago

  • Keywords has-patch dev-feedback added

#2 @swissspidy
8 years ago

  • Version trunk deleted

#3 @Asif2BD
6 years ago

  • Keywords needs-refresh added

Thanks you so much @eugenekireev for your first ticket. I am sorry if its not done yet. @swissspidy could you please confirm what happens afterward?

#4 @swissspidy
6 years ago

@Asif2BD Someone has to review the patch and verify that it's working. Ideally we'd have unit tests for this. Since you added needs-refresh, I suppose the patch needs a refresh, too :-)

Note: See TracTickets for help on using tickets.