Hi,
This module is exactly what I was looking for, but when I tried to create content with three different field that use it, I was given the following message-

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module:174 Stack trace: #0 /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module(174): SimpleXMLElement->__construct('') #1 /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module(120): scribdfield_api_upload('sites/cinemasav...') #2 /home/socalmov/public_html/modules/node/node.module(673): scribdfield_nodeapi(Object(stdClass), 'presave', NULL, NULL) #3 /home/socalmov/public_html/modules/node/node.module(859): node_invoke_nodeapi(Object(stdClass), 'presave') #4 /home/socalmov/public_html/modules/node/node.pages.inc(456): node_save(Object(stdClass)) #5 /home/socalmov/public_html/includes/form.inc(774): node_form_submit(Array, Array) #6 /home/socalmov/public_html/includes/form.inc(414): form_execute_handlers('submit', Array, Array) #7 /home/socalmov/public_html/includes/form.inc(119): drupal_process_form('movie_pitch_nod in /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module on line 174
array(4) { ["type"]=> int(1) ["message"]=> string(1024) "Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module:174 Stack trace: #0 /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module(174): SimpleXMLElement->__construct('') #1 /home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module(120): scribdfield_api_upload('sites/cinemasav...') #2 /home/socalmov/public_html/modules/node/node.module(673): scribdfield_nodeapi(Object(stdClass), 'presave', NULL, NULL) #3 /home/socalmov/public_html/modules/node/node.module(859): node_invoke_nodeapi(Object(stdClass), 'presave') #4 /home/socalmov/public_html/modules/node/node.pages.inc(456): node_save(Object(stdClass)) #5 /home/socalmov/public_html/includes/form.inc(774): node_form_submit(Array, Array) #6 /home/socalmov/public_html/includes/form.inc(414): form_execute_handlers('submit', Array, Array) #7 /home/socalmov/public_html/includes/form.inc(119): drupal_process_form('movie_pitch_nod" ["file"]=> string(75) "/home/socalmov/public_html/sites/all/modules/scribdfield/scribdfield.module" ["line"]=> int(174) } n/a

Thanks-

Comments

trackleft’s picture

I got the same error message.

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/classbu1/public_html/sites/all/modules/scribdfield/scribdfield.module:174 Stack trace: #0 /home/classbu1/public_html/sites/all/modules/scribdfield/scribdfield.module(174): SimpleXMLElement->__construct('') #1 /home/classbu1/public_html/sites/all/modules/scribdfield/scribdfield.module(120): scribdfield_api_upload('sites/all/files...') #2 /home/classbu1/public_html/modules/node/node.module(673): scribdfield_nodeapi(Object(stdClass), 'presave', NULL, NULL) #3 /home/classbu1/public_html/modules/node/node.module(859): node_invoke_nodeapi(Object(stdClass), 'presave') #4 /home/classbu1/public_html/modules/node/node.pages.inc(456): node_save(Object(stdClass)) #5 /home/classbu1/public_html/includes/form.inc(774): node_form_submit(Array, Array) #6 /home/classbu1/public_html/includes/form.inc(414): form_execute_handlers('submit', Array, Array) #7 /home/classbu1/public_html/includes/form.inc(119): drupal_process_form('presentation_no in /home/classbu1/public_html/sites/all/modules/scribdfield/scribdfield.module on line 174

CinemaSaville’s picture

Unfortunately, the module maintainer never addressed this issue so I had to abandon this really cool module.

trackleft’s picture

that sucks, do you want to sponsor it with me? I have 50 bucks.

CinemaSaville’s picture

It's not that crucial to my site, but you can offer the maintainer the cash if you can get ahold of him. Apparently he's supposed to be merging this with the iPaper module as well, but that was several months ago. So I'm not sure what's happening with that now. Would be nice to have this functionality though.

shaneonabike’s picture

I had a similiar issue the main problem was due to files being passed not existing (perhaps on the previous posts the file permissions aren't setup properly).

What is needed:
* A fallback for files that don't actually exist or can't be found.
* A better try / catch around the upload api call

This happened for me from the following scenario:
* Upload a file to a node (not having scribd associated with output)
* Delete that node off of the server
* Associate scribd to Filefield output
* Edit / Save the previous node and you'll get this problem each time.

My fix:

/**
 * Implementation of hook_nodeapi().
 */
function scribdfield_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) {
    case 'presave':
      foreach ($node as $node_key => $node_value) {
        if (strpos($node_key, 'field_') !== FALSE) {
          $field = content_fields($node_key, $node->type);
          if ($field['widget']['module'] == 'scribdfield') {
            unset($_SESSION['scribfield_removed_files']);
            // see scribdfield_widget_process() for sets.

            foreach ($node->{$node_key} as $field_delta => $field_value) {
              if (!empty($node->{$node_key}[$field_delta]['filepath']) &&
                   empty($node->{$node_key}[$field_delta]['data']['scribd_doc_id'])) {
                $response_xml = scribdfield_api_upload($node->{$node_key}[$field_delta]['filepath']);
                if ($response_xml->attributes()->stat == 'ok') {
                  $node->{$node_key}[$field_delta]['data']['scribd_doc_id']           = (string) $response_xml->doc_id;
                  $node->{$node_key}[$field_delta]['data']['scribd_access_key']       = (string) $response_xml->access_key;
                  $node->{$node_key}[$field_delta]['data']['scribd_secret_password']  = (string) $response_xml->secret_pas$
                  drupal_set_message(t('@filepath has been uploaded to Scribd.com.',
                    array('@filepath' => $node->{$node_key}[$field_delta]['filepath'])));
                }
                else {
                  drupal_set_message(t('@filepath could not be uploaded to Scribd.com: @error.', // thank you, usable erro$
                    array('@filepath' => $node->{$node_key}[$field_delta]['filepath'], '@error' => $response_xml->error->a$
                }

To:

/**
 * Implementation of hook_nodeapi().
 */
function scribdfield_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) {
    case 'presave':
      foreach ($node as $node_key => $node_value) {
        if (strpos($node_key, 'field_') !== FALSE) {
          $field = content_fields($node_key, $node->type);
          if ($field['widget']['module'] == 'scribdfield') {
            unset($_SESSION['scribfield_removed_files']);
            // see scribdfield_widget_process() for sets.

            foreach ($node->{$node_key} as $field_delta => $field_value) {
              if (!empty($node->{$node_key}[$field_delta]['filepath']) &&
                   empty($node->{$node_key}[$field_delta]['data']['scribd_doc_id']) &&
                   file_exists($node->{$node_key}[$field_delta]['filepath'])) { // Added a file_exists check here to ensure we aren't try to upload nothing
                $response_xml = scribdfield_api_upload($node->{$node_key}[$field_delta]['filepath']);
                if ($response_xml->attributes()->stat == 'ok') {
                  $node->{$node_key}[$field_delta]['data']['scribd_doc_id']           = (string) $response_xml->doc_id;
                  $node->{$node_key}[$field_delta]['data']['scribd_access_key']       = (string) $response_xml->access_key;
                  $node->{$node_key}[$field_delta]['data']['scribd_secret_password']  = (string) $response_xml->secret_pas$
                  drupal_set_message(t('@filepath has been uploaded to Scribd.com.',
                    array('@filepath' => $node->{$node_key}[$field_delta]['filepath'])));
                }
                else {
                  drupal_set_message(t('@filepath could not be uploaded to Scribd.com: @error.', // thank you, usable erro$
                    array('@filepath' => $node->{$node_key}[$field_delta]['filepath'], '@error' => $response_xml->error->a$
                }
  
mikl’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Category: support » bug
Status: Active » Fixed

I've commited the file_exists check to 6.x-1.x, so it should appear in the dev release very soon. Let me know if that does not fix the issue.

shaneonabike’s picture

Super thanks!

Status: Fixed » Closed (fixed)

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