Opened 9 years ago
Closed 9 years ago
#14509 closed defect (bug) (duplicate)
WordPress Import broken by maybe_serialze
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Import | Keywords: | |
Focuses: | Cc: | ||
PR Number: |
Description
The function maybe_serialize
breaks the WordPress Import Plugin. Any serialized post_meta data that is sent over the importer is double serialized by the maybe_serialize
function. The root of the problem is that within maybe_serialize
there is an explicit check to see if the data is already serialized and if it is, the data is double serialized. This logic is confusing to me.
Fixing maybe_serialize
or changing the way the importer imports data is what is needed. Some might think that unserializing the data in the importer is the way to go but it is not. If a plugin is not installed at the time of import and the serialized data is a custom object that requires a class provided by a plugin then the data will be destroyed.
So I guess it boils down to a question of why does maybe_serialize
explicitly double serialize data. Is there a valid use case for this? I've seen the tickets for when maybe_unserialize
did an is_scalar()
check but that broke plugins that were "doing it wrong". Now I'm "doing it right" and breaking. I've noticed that some imported WordPress data is double serialized as well (when that data is not explicitly excluded from import by the importer) which I'm curious about the implications elsewhere.
I think a patch for this would be pretty simple.
Attachments (1)
Change History (7)
#1
@
9 years ago
- Component changed from General to Import
- Keywords import maybe_serialize removed
- Severity changed from blocker to normal
See #12930 for the explanation of why we double-serialize.
#2
@
9 years ago
We should just maybe_unserialize
everything coming out of post meta tags. I believe things like nav menu item classes are currently broken.
#4
@
9 years ago
#6
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
- Version 3.0 deleted
http://plugins.trac.wordpress.org/changeset/306039 reintroduces maybe_unserialize. Passes updated Unit Tests (more on those soon...)
Closing as duplicate of #10619
patch for maybe_unserialize to not double-serialize