#4109 closed enhancement (fixed)
xprofile_get_field_data not unserializing values
Reported by: | shanebp | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Extended Profile | Keywords: | |
Cc: |
Description
Not sure if this is a bug, but the 1.5.5 rework of bp-xprofile has this side effect:
Or maybe there was a change to WP is_serialized() ?
Change History (6)
#4
@
13 years ago
- Milestone changed from Awaiting Review to 1.6
- Severity changed from normal to minor
- Type changed from defect (bug) to enhancement
I've had a closer look.
The issue is not serialization. The value returned by xprofile_get_field_data()
is indeed unserialized; see this line in the function:
$values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );
(See http://www.php.net/serialize for more on serialize()
in PHP)
What shanebp is pointing toward is that the values returned by xprofile_get_field_data()
are left in an array rather than being converted to a comma-separated string. (In contrast, bp_get_the_profile_field_value()
runs its values through bp_unserialize_profile_field()
before returning, which both unserializes *and* converts to a comma-separated string.) This is not a regression from 1.2.x, though there was a bug in this function 1.2.x that actually *was* related to serialization.
In any case, it seems clear that this is not a bug. And it would break backward-compatibility if the behavior of this function were changed outright. However, I think it's reasonable to add an argument to xprofile_get_field_data()
that will allow you to request a comma-separated string instead of a raw array. I'm going to commit such a change shortly.
Was there a 1.5.5 rework? Is this a regression from 1.5.4?