XF 2.0 Cant unserialize Media Gallery field_choices BLOB

0ptima

Well-known member
Im trying to unserialize a Media Gallery field_choices field (a BLOB) from the xf_mg_media_field table which contains a drop down selection with dates.

192528

I get the following error when I run the code

[E_NOTICE] unserialize(): Error at offset 0 of 85 bytes in src\addons...

Here is my code
PHP:
 $db = \XF::db();
        
 $items = $db->fetchAll('SELECT * FROM `xf_mg_media_field` where convert(`field_id` USING utf8 ) = 5');
        
foreach ($items AS $item)
{     
   $custom_field = unserialize($item['field_choices']);
}

When I run it through the debugger, I can see the field choices

192527


I have successfully unserialized other BLOBs using the same method so I dont understand why it does not work with this particular field.
 
Back
Top Bottom