Thanks for the recent commit that allowed Scribd documents to be secure (so they can't be downloaded). This functionality works great when you first save the node, but if you later go back and try to re-save the node (perhaps because you changed the node body text), then a White Screen of Death fatal error occurs. They only way to get rid of this WSOD is to delete the secure file from the node altogether and then re-save.

Here's the error message that is appearing in my PHP error log:

PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /Users/benkaplan/git/drupal-6.20/sites/all/modules/scribdfield/scribdfield.module:222

And here's some more error info that's also printing in the error log:

Stack trace:
#0 /Users/benkaplan/git/drupal-6.20/sites/all/modules/scribdfield/scribdfield.module(222): SimpleXMLElement->__construct('')
#1 /Users/benkaplan/git/drupal-6.20/sites/all/modules/scribdfield/scribdfield.module(129): scribdfield_api_upload('sites/default/f...')
#2 /Users/benkaplan/git/drupal-6.20/modules/node/node.module(679): scribdfield_nodeapi(Object(stdClass), 'presave', NULL, NULL)
#3 /Users/benkaplan/git/drupal-6.20/modules/node/node.module(871): node_invoke_nodeapi(Object(stdClass), 'presave')
#4 /Users/benkaplan/git/drupal-6.20/modules/node/node.pages.inc(456): node_save(Object(stdClass))
#5 /Users/benkaplan/git/drupal-6.20/includes/form.inc(782): node_form_submit(Array, Array)
#6 /Users/benkaplan/git/drupal-6.20/includes/form.inc(422): form_execute_handlers('submit', Array, Array)
#7 /Users/benkaplan/git/drupal-6.20/includ in /Users/benkaplan/git/drupal-6.20/sites/all/modules/scribdfield/scribdfield.module on line 222

Thoughts?

Thanks,
Ben

CommentFileSizeAuthor
#2 1091500.patch1.42 KBgoogletorp

Comments

mikl’s picture

Status: Active » Needs work

I have managed to prevent the exception by not trying to upload a file if there is no file to upload.

However, I haven't been able to figure out how to prevent it from nuking the Scribd data when you re-save the node. Somehow, the data-column in the field data gets set to FALSE, and it is where the access key and document ID from Scribd is stored, so once they are gone, the document becomes irretrievable.

I wonder if it was better to convert the module to being its own type, instead of piggybacking on Filefield.

googletorp’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB

I fixed this issue and found a minor bug fix that's included in the patch.

It seems the problem was, that the data array wasn't copied to the #value on node resave by _form_builder_handle_input_element. Instead of trying to find out why, it seemed simpler to just add it if it was missing and availble from the #default_value.

mikl’s picture

Status: Needs review » Fixed

Commited to 6.x-1.x – thanks :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.