Support » Plugin: Phoenix Media Rename » unserialize(): Error at offset

  • Resolved alx359

    (@alx359)


    I’m getting the following php notice each time an image is renamed. The image seems to get renamed anyway. Please advise. Thank you.

    PHP Notice:  unserialize(): Error at offset 13010 of 13032 bytes in D:\domains\wp.evitaworks.com\wp-content\plugins\phoenix-media-rename\class-media-rename.php on line 411
    PHP Stack trace:
    PHP   1. {main}() D:\domains\wp.mydomain.com\wp-admin\admin-ajax.php:0
    PHP   2. do_action() D:\domains\wp.mydomain.com\wp-admin\admin-ajax.php:100
    PHP   3. WP_Hook->do_action() D:\domains\wp.mydomain.com\wp-includes\plugin.php:453
    PHP   4. WP_Hook->apply_filters() D:\domains\wp.mydomain.com\wp-includes\class-wp-hook.php:310
    PHP   5. Phoenix_Media_Rename->ajax_pnx_rename() D:\domains\wp.mydomain.com\wp-includes\class-wp-hook.php:286
    PHP   6. Phoenix_Media_Rename::do_rename() D:\domains\wp.mydomain.com\wp-content\plugins\phoenix-media-rename\class-media-rename.php:158
    PHP   7. Phoenix_Media_Rename::unserialize_deep() D:\domains\wp.mydomain.com\wp-content\plugins\phoenix-media-rename\class-media-rename.php:250
    PHP   8. unserialize() D:\domains\wp.mydomain.com\wp-content\plugins\phoenix-media-rename\class-media-rename.php:411
Viewing 6 replies - 1 through 6 (of 6 total)
  • alx359

    (@alx359)

    The offending line 411:
    $var = @unserialize($var);

    Peeking into $var though returns a large number of verbose serialized data that seem taken from varied db columns. There are many of these which do not seem related to an image name. The quick-fix that worked for me was just adding the @ operator to the above expression, namely:

    static function unserialize_deep($var) {
    	while ( is_serialized($var) ) {
    		$var = @unserialize($var); //alx359
    	}
    
    	return $var;
    }
    
    Plugin Author crossi72

    (@crossi72)

    Hi @alx359,
    I’ll check for this warning as soon as possible, thank for your suggested fix.

    C.

    Plugin Author crossi72

    (@crossi72)

    I released version 1.3.1 that removes those useless warnings, can you tell me which plugin are you using, so I can look for a more robust solution to this issue?

    Thanks
    C.

    alx359

    (@alx359)

    Thanks, Claudio, for the new update so quickly!

    Sorry, but what do you mean by which plugin? If you meant what plugins I’ve installed, they’re actually a lot. And for looking at the log, at glance can’t really tell which one of those may have a badly formatted serialization.

    Anyway, can confirm the “stfu” operator makes the notice go away for good, and PMR seems to be doing its job well while renaming hundreds of image files at once. However, I’m using PMR in conjunction with Fix Media Library, as it seems there are a number of inconsistencies left during the renaming process.

    Cheers,
    Alex

    Plugin Author crossi72

    (@crossi72)

    At the moment I’ve just applied the workaround you suggested, I’d like to make a test with your plugin configuration to address better this issue.

    I don’t know Fix Media Library but form the description seems a good candidate to raise this kind of problem, I’ll check as soon as possible.

    Cheers
    C.

    alx359

    (@alx359)

    Of course. Have opened a ticket.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘unserialize(): Error at offset’ is closed to new replies.