Fixed Serialized value contains an object and this is not allowed

Divvens

Well-known member
Get the following error when you delete an album and select to send an alert to user (without filling out any content on the alert), XF 1.5.6 and latest XFMG

PHP:
XenForo_Exception: Serialized value contains an object and this is not allowed - library/XenForo/DataWriter/Helper/Denormalization.php:40
Generated By: Divvens, 3 minutes ago
Stack Trace
#0 /home/xxxxxx/public_html/library/XenForo/DataWriter/Alert.php(86): XenForo_DataWriter_Helper_Denormalization::verifySerialized('a:4:{s:6:"reaso...', Object(XenForo_DataWriter_Alert), 'extra_data')
#1 [internal function]: XenForo_DataWriter_Alert->_verifyExtraData('a:4:{s:6:"reaso...', Object(XenForo_DataWriter_Alert), 'extra_data', Array)
#2 /home/xxxxxx/public_html/library/XenForo/DataWriter.php(996): call_user_func_array(Array, Array)
#3 /home/xxxxxx/public_html/library/XenForo/DataWriter.php(725): XenForo_DataWriter->_runVerificationCallback(Array, 'a:4:{s:6:"reaso...', Array, 'extra_data')
#4 /home/xxxxxx/public_html/library/XenForo/DataWriter.php(643): XenForo_DataWriter->_isFieldValueValid('extra_data', Array, 'a:4:{s:6:"reaso...', Array)
#5 /home/xxxxxx/public_html/library/XenForo/Model/Alert.php(450): XenForo_DataWriter->set('extra_data', Array)
#6 /home/xxxxxx/public_html/library/XenForo/Model/Alert.php(426): XenForo_Model_Alert->alertUser(10916, 0, '', 'user', 10916, 'xengallery_albu...', Array)
#7 /home/xxxxxx/public_html/library/XenGallery/Model/Media.php(3517): XenForo_Model_Alert::alert(10916, 0, '', 'user', 10916, 'xengallery_albu...', Array)
#8 /home/xxxxxx/public_html/library/XenGallery/ControllerPublic/Abstract.php(345): XenGallery_Model_Media->sendAuthorAlert(Array, 'xengallery_albu...', 'delete', Array, Array, 'album_user_id')
#9 /home/xxxxxx/public_html/library/XenGallery/ControllerPublic/Album.php(395): XenGallery_ControllerPublic_Abstract->_sendAuthorAlert(Array, 'xengallery_albu...', 'delete', Array, 'album_user_id')
#10 /home/xxxxxx/public_html/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Album->actionDelete()
#11 /home/xxxxxx/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /home/xxxxxx/public_html/index.php(13): XenForo_FrontController->run()
#13 {main}
Request State
array(3) {
  ["url"] => string(56) "http://orojackson.com/media/albums/grand-live.815/delete"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(9) {
    ["hard_delete"] => string(1) "0"
    ["reason"] => string(0) ""
    ["send_author_alert"] => string(1) "1"
    ["author_alert_reason"] => string(0) ""
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(29) "/media/albums/grand-live.815/"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
@Chris D this bug still exists in 1.1.6a

When deleted without giving a reason but still checking the 'alert'

To recreate;
- Delete an album or media item (hard delete)
- Check-box option to alert
- Don't type any reason to alert
- Error pops up

PHP:
XenForo_Exception: Serialized value contains an object and this is not allowed - library/XenForo/DataWriter/Helper/Denormalization.php:40
Generated By: Divvens, 2 minutes ago
Stack Trace

#0 /home/xxxx/public_html/library/XenForo/DataWriter/Alert.php(86): XenForo_DataWriter_Helper_Denormalization::verifySerialized('a:4:{s:6:"reaso...', Object(XenForo_DataWriter_Alert), 'extra_data')
#1 [internal function]: XenForo_DataWriter_Alert->_verifyExtraData('a:4:{s:6:"reaso...', Object(XenForo_DataWriter_Alert), 'extra_data', Array)
#2 /home/xxxx/public_html/library/XenForo/DataWriter.php(996): call_user_func_array(Array, Array)
#3 /home/xxxx/public_html/library/XenForo/DataWriter.php(725): XenForo_DataWriter->_runVerificationCallback(Array, 'a:4:{s:6:"reaso...', Array, 'extra_data')
#4 /home/xxxx/public_html/library/XenForo/DataWriter.php(643): XenForo_DataWriter->_isFieldValueValid('extra_data', Array, 'a:4:{s:6:"reaso...', Array)
#5 /home/xxxx/public_html/library/XenForo/Model/Alert.php(450): XenForo_DataWriter->set('extra_data', Array)
#6 /home/xxxx/public_html/library/XenForo/Model/Alert.php(426): XenForo_Model_Alert->alertUser(8179, 0, '', 'user', 8179, 'xengallery_albu...', Array)
#7 /home/xxxx/public_html/library/XenGallery/Model/Media.php(3518): XenForo_Model_Alert::alert(8179, 0, '', 'user', 8179, 'xengallery_albu...', Array)
#8 /home/xxxx/public_html/library/XenGallery/ControllerPublic/Abstract.php(345): XenGallery_Model_Media->sendAuthorAlert(Array, 'xengallery_albu...', 'delete', Array, Array, 'album_user_id')
#9 /home/xxxx/public_html/library/XenGallery/ControllerPublic/Album.php(408): XenGallery_ControllerPublic_Abstract->_sendAuthorAlert(Array, 'xengallery_albu...', 'delete', Array, 'album_user_id')
#10 /home/xxxx/public_html/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Album->actionDelete()
#11 /home/xxxx/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#12 /home/xxxx/public_html/index.php(13): XenForo_FrontController->run()
#13 {main}

Request State
array(3) {
  ["url"] => string(52) "http://orojackson.com/media/albums/marine.860/delete"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(8) {
    ["hard_delete"] => string(1) "1"
    ["send_author_alert"] => string(1) "1"
    ["author_alert_reason"] => string(0) ""
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(25) "/media/albums/marine.860/"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
This certainly seemed specific to hard deleting an album, but regardless there is a fail-safe in place now to ensure this doesn't creep back in.

If you want to implement that yourself, edit the file library/XenGallery/Model/Media.php and find:
PHP:
if ($options['authorAlert'])

And add on the line above:
PHP:
unset($content['albumPermissions'], $album['albumPermissions']);
 
Top Bottom