I'm getting a "Fatal error: Call to undefined function xxxxxx() in /sites/all/themes/mytheme/template.php" when I try to import an .ris file. First the function was biblio_openurl(), so I commented out that line, then it was _biblio_keyword_links(), so I commented that out, then it was _build_biblio_link(), so I gave up on that tack :)

I am using theme overrides in template.php of theme_biblio_long() and theme_biblio_export_links() in my template.php file, and - strangely enough - I don't get the fatal errors when viewing a biblio node (and the openURL and Keyword links display just fine when they're not commented out).

I'm not sure why the theming functions are even being called on import. I assume both import mechanisms are the same, but FWIW this happens both at admin/settings/biblio/import and at biblio/import/form.

Thanks!

CommentFileSizeAuthor
#2 import.ris_.txt9.9 KBJohn Bickar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rjerome’s picture

I don't know why this would be happening, the import code doesn't call any theme functions.

Are you using "batch" import or direct?

BTW, "admin/settings/biblio/import and biblio/import/form" are one in the same, just a different route to get there.

John Bickar’s picture

FileSize
9.9 KB

This was with the direct method. The type of error message I get is a general PHP fatal error message (white screen).

When I try batch, it also fails, but I get "An error has occurred. Please continue to the error page." And Drupal has set an error message of:

An error occurred. /batch?id=23&op=do <br /> <b>Fatal error</b>: Call to undefined function biblio_openurl() in <b>sites/all/themes/mytheme/template.php</b> on line <b>281</b><br />

I wonder if there's a problem with the import file? It's attached. I'll try breaking it up and seeing if I can isolate the problem.

Thanks!

rjerome’s picture

I imported it without issue, so I don't think it's the file.

John Bickar’s picture

Hm. I took out the first record in the .ris file and it imported OK. When I try to import just that record as an .ris file, it chokes with the same error. There doesn't seem to be anything unusual about that record, nor does it explain why I get that particular error message. Let's hope it doesn't show up again.

TY  - BOOK
ID  - 5084
T1  - Report on the state of the provision of quality education in schools in the Gambia
Y1  - 2007
SP  - 26
KW  - Education Gambia
PB  - Gambia Teachers Union
CY  - Banjul, Gambia
A3  - Anonymous
N1  - LA1621 .R47 2007 1 NEWBOOKS
M1  - Book, Whole
ER  - 
John Bickar’s picture

When it gives the fatal error on import, it does import the record, with the author of the Drupal node set to Anonymous.

When I go to edit that node, give it a taxonomy term and change the author (of the Drupal node) to my user, it fails with the same "fatal error: call to undefined function".

I have a workaround for now so no need to keep this issue active, but I'll post back if I run into this again or come up with more info.

Thanks!

rjerome’s picture

The only thing I can think of is that maybe that file contained some none visible characters at the beginning. Can't imagine how the "node author" got set to Anonymous. Are you selecting a "User ID" from the drop down list on the import form or are you just letting it default to your own name?

Did you try downloading the file from above in this post and importing it?

John Bickar’s picture

Same error when using the file attached to this post.

And yes, I'm just letting the author default to my user.

John Bickar’s picture

Strange, I just got the "call to undefined function biblio_openurl()" again when editing a biblio node. I have been noticing that when I edit an author's name on a record that has been imported, the edit does not "stick". My first thought was that this was a glitch in the AJAX interface, but this happens with JS on or off.

So I tried to delete both authors and that was when I got the fatal error (upon saving).

John Bickar’s picture

Some more data points:

  1. After the fatal error upon saving, when I would go to view the node, I would see a WSOD with the same fatal error message.
  2. A View that had this biblio node in it was showing the node title, but not other fields that I was choosing to display (notes and attached image)
  3. The fields for that record in the {biblio} database table seemed uncorrupted; nothing is amiss as far as I can tell.
  4. When I go back in and edit the node to add the authors, the fatal error goes away, the authors' names are as I have entered them, and everything is copacetic again.

I haven't looked closely at the code to see how much it shares with the D5 version, but I'm wondering if it has anything to do with the "Cannot create publications without authors" bug from biblio 5.x.

Still a stumper as to why it's choking on biblio_openurl(), but I'll try to do some more testing on Monday and see if I can narrow it down a little more.

Thanks!

rjerome’s picture

Did you enter a "OpenURL Base URL" in the OpenURL section of the admin/settings/biblio page? If so, that's why biblio_openurl() is getting called. Did the undefined function call error happen on "Preview" during editing?

John Bickar’s picture

Did you enter a "OpenURL Base URL" in the OpenURL section of the admin/settings/biblio page?

Yes; this setting carried over from my 5.x setup.

Did the undefined function call error happen on "Preview" during editing?

No, I didn't preview the node; it happened when I clicked "Save".

John Bickar’s picture

Now it's strangely popping (intermittently, but reproducibly) up on faceted_search results pages. Again, no idea why it calls that function, and commenting out the call to biblio_openurl() just moves the fatal error message to biblio_keyword_links().

I know that theme_biblio_long() is deprecated, but is there currently a better way to theme the full display of biblio nodes than overriding that function? For the time being I have removed the theme function override from my template.php.

Thanks!

rjerome’s picture

You wouldn't be running out of memory would you? Have you checked your PHP error logs?
Do you have the "Devel" module enabled? I've seen it do wicked bad things when you least expect it :-(

John Bickar’s picture

Do you have the "Devel" module enabled?

Not on the production site, no.

You wouldn't be running out of memory would you?

I don't think so, although it's possible. I have devel enabled on a mirror dev site and it shows 40MB used on a path that works, and 30MB used on the path that throws the fatal error (server memory limit is set to 64MB).

Have you checked your PHP error logs?

Hadn't done that, oops. Here's what it's throwing:

Invalid argument supplied for foreach() in /sites/all/modules/ctools/plugins/arguments/term.inc on line 50.

But it apparently is generating that on other paths as well, not just the ones that throw the biblio fatal error. That error is discussed in #467898: Invalid argument supplied for foreach() in term.inc, but appears to be unrelated to the biblio error.

Edit: Removing duplicate taxonomy terms got rid of the ctools error message; now I get no error messages when calling up a path that causes the biblio fatal error.

rjerome’s picture

Hmmm, so you still get biblio fatal errors, but nothing in the logs?

Did you say you had overridden some of the theme code? Perhaps that is the issue since biblio_openurl() is in the biblio_theme.inc file and if that's not getting included then it wouldn't find it.

John Bickar’s picture

Right, I've overridden theme_biblio_long() in my template.php file.

I know the comments say that it's deprecated, but as far as I can tell, that's the function that outputs the full node view when you have the "Original" node layout style selected.

Maybe there's a better way to theme the node display?

rjerome’s picture

What level of caching are you using? Try disabling all caching and see if that makes any difference.

John Bickar’s picture

I was using normal caching with page compression, CSS compression, and JS compression enabled. I disabled all of those settings and flushed the cache and still get the fatal error.

rjerome’s picture

Hmmm, I'm running out of ideas here!! I wish I could reproduce this on my systems, but I can't, so it's kind of hard to fix :-0

It still sounds suspiciously system related.

What are you running on? OS/PHP/HTTP?

John Bickar’s picture

I know, it's a stumper! I really do appreciate your help.

Debian stable (etch, I think? but maybe lenny)
Apache 2.2.3
PHP Version 5.2.0-8+etch13

phpinfo()

I also get a WSOD with no error messages on screen or in the log with the same configuration in a local MAMP environment.

ETA: Same fatal error in MAMP; I had to set display_errors to On.

rjerome’s picture

On your MAMP platform (I presume that's your test platform) could you try NOT overriding the theme functions and see what happens?

John Bickar’s picture

I actually took out the theme function override in the production environment last week, and it works fine with no fatal errors (that I've seen so far).

I have one dev environment in MAMP and one on our live web servers as well, as I can tweak server settings on MAMP, but can't on the web servers.

I changed the "Node Layout" (at admin/settings/biblio under "Styling") from "original" to "tabular" and the fatal error went away, so it's definitely in that theme override function, but we knew that from the beginning due to the error message.

It still doesn't make any sense to my why I would get that fatal error when doing an import or using faceted search (and not, for example, when actually viewing a biblio node).

rjerome’s picture

That's a head scratcher for sure. Maybe if you send me the theme override code I can make it happen on my end and thus get closer to an answer.

Ron.

John Bickar’s picture

Oops, sorry, been working on other stuff and forgot to follow up on this.

Here's the code. As I said, I've removed this from the template.php for the time being, therefore I'm no longer seeing the errors.

Not a lot of stuff going on in there right now, but there is some call number hyperlinking (not included) that I'd like to reintroduce at some point and it will require using a theme override.


/**
 * DEPRECIATED! this was the original output format which is not to flexable it will be removed
 * TODO: remove this function
 * @param $node
 * @param $base
 * @param $style
 * @return unknown_type
 */

function cubb_biblio_long($node, $base = 'biblio', $style = 'classic') {
  if (module_exists('popups')){
     popups_add_popups();
  }
  if (empty ($node->biblio_coins))
    biblio_coins_generate($node);
  $output .= $node->biblio_coins;
  $layout = variable_get('biblio_node_layout', 'orig');
  if (variable_get('biblio_node_layout', 'orig') == 'ft' && strlen(trim($node->body)) && user_access('view full text')) {
    $output .= '<div class="biblio-head">'. theme('biblio_style', $node, $base, $style) .'</div>';
    $annotation_field = variable_get('biblio_annotations', 'none');
    if ($annotation_field != 'none' && $node-> $annotation_field) {
      $output .= '<div class="biblio-annotation">';
      $output .= check_markup($node-> $annotation_field, $node->format, FALSE);
      $output .= '</div>';
    }
    $output .= check_markup($node->body, $node->format, FALSE);
    if (biblio_access('export', $node)) {
      $output .= theme('biblio_export_links', $node->nid);
    }
    return $output;
  }
  foreach ((array)$node->biblio_contributors[1] as $auth) {
    $authors[] = theme('biblio_author_link', $auth['name'], $auth['cid']);
  }
  $authors = implode('; ', (array)$authors);
  $openurl_base = variable_get('biblio_baseopenurl', '');
  if ($openurl_base)
    $output .= theme('biblio_openurl', biblio_openurl($node, $openurl_base));
  $output .= '<div class="biblio_type"><h3>'. t("Publication Type") .":</h3> $node->biblio_type_name</div>\n";
  $output .= '<div class="biblio_authors"><h3>'. t("Authors") .':</h3> '. $authors ."</div>\n";
  $output .= '<div class="biblio_source"><h3>'. t("Source") .': </h3> ';
  $source = null;
  if ($node->biblio_secondary_title)
    $source .= check_plain($node->biblio_secondary_title);
  if ($node->biblio_publisher) {
    $source .= $source ? ", " : "";
    $source .= check_plain($node->biblio_publisher);
  }
  if ($node->biblio_volume) {
    $source .= $source ? ", " : "";
    $source .= t('Volume ') . check_plain($node->biblio_volume);
  }
  if ($node->biblio_issue) {
    $source .= $source ? ", " : "";
    $source .= t('Issue ') . check_plain($node->biblio_issue);
  }
  if ($node->biblio_number) {
    $source .= $source ? ", " : "";
    $source .= t('Number ') . check_plain($node->biblio_number);
  }
  if ($node->biblio_place_published) {
    $source .= $source ? ", " : "";
    $source .= check_plain($node->biblio_place_published);
  }
  if ($node->biblio_pages) {
    $source .= $source ? ", " : "";
    $source .= 'p.'. check_plain($node->biblio_pages);
  }
  if (isset ($node->biblio_year)) {
    if ($node->biblio_year == 9998) {
      $node->biblio_year = t("In Press");
    }
    if ($node->biblio_year == 9999) {
      $node->biblio_year = t("Submitted");
    }
    $source .= ' ('. check_plain($node->biblio_year) .')';
  }
  $output .= "$source</div>\n";
  if ($node->biblio_call_number) {

		$output .= '<div class="biblio-call-number"><h3>'.t("Call Number").':</h3> ' . check_plain($node->biblio_call_number) . "</div>\n";  //makes non-Cubberley books non-hyperlinked

  } 
  if ($node->biblio_accession_number)
    $output .= '<h3>'. t("Accession Number") .':</h3> '. check_plain($node->biblio_accession_number) ."\n";
  if ($node->biblio_other_number)
    $output .= '<h3>'. t("Other Number") .':</h3> '. check_plain($node->biblio_other_number) ."\n";
  if ($node->biblio_url) {
    $attrib = (variable_get('biblio_links_target_new_window', null)) ? array(
      'target' => '_blank'
    ) : array();
    $output .= '<h3>'. t("URL") .':</h3>'. l($node->biblio_url, $node->biblio_url, $attrib) ."\n";
  }
  if (!empty($node->biblio_keywords)) {
    $output .= '<h3>'. t("Keywords") .':</h3> '. _biblio_keyword_links( $node->biblio_keywords, $base) ."\n";
  }
  if ($node->biblio_abst_e)
    $output .= '<h3>'. t("Abstract") .':</h3> '. check_markup($node->biblio_abst_e, $node->format, FALSE) ."\n";
  if ($node->biblio_abst_f)
    $output .= '<p>'. check_markup($node->biblio_abst_f, $node->format, FALSE) ."\n";
  if ($node->biblio_notes)
    $output .= '<h3>'. t("Notes") .': </h3>'. check_markup($node->biblio_notes, $node->format, FALSE) ."\n";
  if ( strlen(trim($node->body)) && user_access('view full text') ) {
       $output .= '<h3>'.t('Full Text').':</h3>'.check_markup($node->body, $node->format, FALSE);
  }
  
  if (biblio_access('export', $node)) {
    $output .= theme('biblio_export_links', $node->nid);
  }
  return $output;
}

Liam Morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.