unserialize() error in mediamose_response.inc

08Jun2012

I've encountered multiple entries in apache error_log regarding php unserialize() error. Here's an example:

[Fri Jun 08 15:45:44 2012] [error] [client xx.xx.xx.xx] In /var/www/html/sites/all/modules/mediamosa/response/mediamosa_response.inc at line 535; unserialize(): Error at offset 0 of 1 bytes (function: )mediamosa_response->generate_xml_add_child().

Any idea what could be causing this? Running 2.3.17.

Comments

.

Its caused by code that adds attributes to a XML tag. The XML attributes are stored as serialized data during the XML generation.

Its a way I really regret that I ever wrote into the engine, at the time it was the best option. Its on my list for MM3.5 to get rid off.

You can find the cause by searching for

['#' . serialize(array('

If you are able to figure out which REST call is causing it (guessing /asset/[id]), then you might find what data is causing it by turning off those found hits on

['#' . serialize(array('

and I might be able to help you further with fixing it.

There should be 4 places in code where this serialize trick is used.

I can't say if 3.x will fix your notice however, as the notice is caused by specific data in your database, its not directly code related.

Hi Robert, Thank you for you

Hi Robert,

Thank you for your quick response. Indeed these errors are triggered by /asset/$assetid requests.
Should I search the whole codebase, or specific modules?

You said: "If you are able to figure out which REST call is causing it (guessing /asset/[id]), then you might find what data is causing it by turning off those found hits on
['#' . serialize(array('
"
I don't understand it, what should be replaced with what?

Just comment out the whole

Just comment out the whole line, it will not break anything (well not server side) and see if the notice goes away. Once it does, then let me know which one you commented out. Then the next step is what kind of data it tries to serialize (by logging the data) and why it gives the notice. But I'll provide you the code for that as soon as I know where in the code this notice happens.

Hi Robert, I have found 3

Hi Robert, I have found 3 occurrences:

sites\all\modules\mediamosa\core\asset\mediafile\mediamosa_asset_mediafile.inc

sites\all\modules\mediamosa\core\asset\mediafile\play_proxy\mediamosa_asset_mediafile_play_proxy.inc

sites\all\modules\mediamosa\maintenance\automatedsimpletest\mediamosa_maintenance_automatedsimpletest.rest.inc

My guess it is mediamosa_asset_mediafile.inc, but I'll test to be sure and get back to you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.