#15030 closed defect (bug) (wontfix)
Unserialize deep when returning arrays of metadata
Reported by: | nacin | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Options, Meta APIs | Keywords: | revert |
Focuses: | Cc: |
Description (last modified by )
Currently when retrieving an array of metadata values for an object (no meta key specialized), they are retrieved as serialized. Only when meta key is specified do we unserialize.
We should array_map( 'maybe_unserialize' ) on what we plan to return instead of forcing plugins to call that themselves.
Attachments (4)
Change History (27)
#2
@
14 years ago
- Description modified (diff)
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 3.1
#3
@
14 years ago
- Keywords needs-patch added; has-patch removed
According to dd32 this patch doesn't go deep enough, and needs to go one level down. Sounds about right.
#7
@
10 years ago
@boonebgorges I heard your talk at SF WordCamp last weekend, very inspiring. I'd like to wet my feet with contributing to core and I have submitted a possible solution to this ticket.
Can you take a look and let me know if I am moving in the right direction here?
#9
follow-up:
↓ 10
@
10 years ago
Looking this over again, I think using an anonymous function here might be more appropriate to avoid needing the new callback function in /wp-includes/functions.php, since that function is not likely to be needed anywhere else.
#10
in reply to:
↑ 9
@
10 years ago
Replying to mattkeys:
Looking this over again, I think using an anonymous function here might be more appropriate to avoid needing the new callback function in /wp-includes/functions.php, since that function is not likely to be needed anywhere else.
It looks like anonymous functions only became available in PHP 5.3, and WP supports PHP 5.2.4, so I guess we cannot use the anonymous function version of my patch.
#12
in reply to:
↑ 11
@
10 years ago
Replying to nacin:
Hey mattkeys, we're still PHP 5.2.4+.
Yea I realized right after submitting that second version of the patch that the anonymous function was not going to be available to us. Any thoughts on the first version I posted?
#13
follow-up:
↓ 14
@
10 years ago
- Milestone changed from Future Release to 4.1
- Owner set to boonebgorges
- Status changed from new to accepted
I think we can probably do this without writing a new function. Let's just loop over the values and map maybe_unserialize()
on them.
#14
in reply to:
↑ 13
@
10 years ago
Replying to boonebgorges:
I think we can probably do this without writing a new function. Let's just loop over the values and map
maybe_unserialize()
on them.
Yea I was overcomplicating things here. New patch submitted.
#15
@
10 years ago
mattkeys - Yup, that's exactly what I had in mind. I'll write a couple unit tests for it and we'll put it in. Thanks for the contribution!
#17
@
10 years ago
This is kind of obvious, but this is one thing that's worth noting is no longer backwards compatible (and affects,get_post_custom()
, get_post_meta()
, and get_metadata()
).
If anyone was expecting a serialized string and passing it to unserialize() things will now break. If they were using maybe_unserialize() it will silently still work.
#18
@
10 years ago
- Keywords revert added; needs-unit-tests good-first-bug has-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
We're seeing breakage on WordPress.com VIP due to this change. Reopening to consider a revert.
Sounds reasonable.
What is the WP function your going to patch here?