Updating
An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.
Please continue to the error page
An error occurred. http://uits.margrit.webdev.uits.arizona.edu/update.php?id=13&op=do
Fatal error: Call to undefined function content_field_tablename() in /home/memcinto/sites/uits/sites/all/modules/cck/modules/userreference/userreference.install on line 127

This was in my testing sandbox. I had already installed the new version of Views (6.x-2.7). I disabled everything in Date and CCK, updated CCK, and ran update. Got the above error. Backed out to 6.x-2.5, now all is well. Tried updating to 6.x-2.6 again, got same error. Backed out again.

CommentFileSizeAuthor
#38 625768-userreference_update.patch620 bytesCrell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sc0tt’s picture

Same here.

markus_petrux’s picture

Status: Active » Needs review

Ugh! I wonder how is it possible it went undetected until now. This is my bad as I forgot to load content module in the hook_update_N() implementation. Apologies for the headache.

It can be fixed by adding the following on top of in userreference.install:

 function userreference_update_6002() {
   $ret = array();

+  drupal_load('module', 'content');

   $result = db_query("SELECT field_name, global_settings FROM {". content_field_tablename() ."} WHERE type = 'userreference'");
markus_petrux’s picture

Title: CCK 6.x-2.6, got fatal error on update.php » CCK 6.x-2.6, got fatal error on update.php while running userreference_update_6002()
Status: Needs review » Fixed
joshuautley’s picture

Fatal error: Call to undefined function content_cache_tablename() in /home/{my_site}/public_html/sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 225

Little help?

markus_petrux’s picture

@joshuautley: Yours is a completely different issue.

1) content_cache_tablename() is implemented by content module.
2) fieldgroup module requires content module, so it seems that you have fieldgroup module enabled but content module is not for some reason.

Make sure you have all the files of the CCK package in the correct place. Also, check if you have more instances of CCK in other directories such as sites/domain/modules, site/all/modules, etc.

In any case, if you need to follow up on your problem, then please open a separate issue. Thanks.

joshuautley’s picture

Ok, thank you.

osherl’s picture

I have just upgraded to 2.6 and all the data in the CCK part of the node has been deleted. I am trying to figure out what happened... I use Faceted Search with CCK Facets... I will let you know.

NikLP’s picture

Enlighten me here - are we still saying that the data will be corrupted on the latest release? This should be grounds for a new release surely?

If I've updated to 2.6 without doing this patch, how can I test if I'm a victim of the corruption?

wickwood’s picture

Patch in #2 worked for me.

markus_petrux’s picture

@osherl: I think your problem is not related to this issue.

@NikLP: This patch fixes an issue in the latest update step in userreference module. This update is aimed to fix userreference field settings. It does not alter user data, only the definitions of the field. This bug was introduced when trying to fix another issue: #416134: Userreference, impossible to filter allowed values by blocked users.

NikLP’s picture

So we still need to apply it, or it's been re-rolled, or...?

markus_petrux’s picture

That patch has been committed to CVS, and it should be safe to apply (see the patch HERE, it's just one line). It simply loads content.module during the update step so that the function content_field_tablename() can be found. Otherwise an error will be reported.

NikLP’s picture

Well I edited the file, re-ran the update but it said no query, so I'm *guessing* that's ok - the initial update was performed with drush, but I get so much chaff output from that in my environment I couldn't even tell you if I got the initial error or not - I didn't on the re-run in any case.

If there's anything else we should know.... :)

markus_petrux’s picture

You should be able to re-run the latest update step in userreference module.

To proceed, visit update.php, and follow all recommendations (backups, put the site in maintenance mode, etc.), then click Continue and find the selector for userreference module. Even it the system tells you there's no update available, you can still select the update option 6002, and then submit.

This update step walks the list of all userreference fields in your system and updates the structure of the global settings of the field to fix an error that was present before. You could fix this using the automatic process implemented in the update step, or you can edit the settings of all your userreference fields manually, review the "User status that can be referenced" option to make sure it is defined as you really need, and then save the field settings form.

That's all there is in this update step. It does not affect user data, only field settings about something that was buggy before.

Anne-Pierre’s picture

thanks markus_petrus, this seems to have done the trick for me.

castawaybcn’s picture

markus_petrux, I tried following your instructions but:
a) the patch seemed to be already applied in the latest version
b) there was no entry for userreference in the update page (and I looked thoroughly)
everything seems fine though, I got no errors at all

superflyman’s picture

@markus_petrux

So, essentially, all we need to do is add:

+ drupal_load('module', 'content');

to the appropriate line in userreference.install and it should be all good to run update 6002?

I just wanted to be sure that there wasn't a larger patch or something else that needs to be done. Thanks and sorry for my confusion.

markus_petrux’s picture

Yes, that's what the patch does to prevent this problem in the future.

W.M.’s picture

SO the patch that can be found now on module download page needs to be applied to the latest release "CCK 6.x-2.6" before running update.php?!

micksatana’s picture

Title: CCK 6.x-2.6, got fatal error on update.php while running userreference_update_6002() » Question on the topic: CCK 6.x-2.6, got fatal error on update.php while running userreference_update_6002()
Priority: Normal » Minor

I'm a newbie in Drupal and also never do module patching and updating stuff before..

I just updated views 6007 and userreference 6002 at the same time without running the patch, but no error occurs at all. is it okay?, or it might have hidden malfunction somewhere?

Standart’s picture

Title: Question on the topic: CCK 6.x-2.6, got fatal error on update.php while running userreference_update_6002() » Fatal error while running userreference_update_6002()
Category: support » bug
Priority: Minor » Critical

So you're saying the officially stable version 2.6 needs patching but there's no new release?

NikLP’s picture

I did say...! This is something that should be made into a new release. You can't have a proper release with a known bug like this is in it, it's madness!

chriscohen’s picture

+1 to NikLP in #22. That is madness. A new release should be issued. I don't know how this can be marked as 'fixed'! I just downloaded 6.x-2.6 and still needed to apply the patch.

DamienMcKenna’s picture

Another vote for a quick-fix release.

W.M.’s picture

New release please!

jimdemon’s picture

I received the same error after adding the patch and rerunning update.php except it shows in line 129 instead of 127 now.

An error occurred. http://localhost:8888/drupal/update.php?id=19&op=do
Fatal error: Call to undefined function content_field_tablename() in /Applications/MAMP/htdocs/drupal/sites/all/modules/cck/modules/userreference/userreference.install on line 129

jimdemon’s picture

Nevermind, entered a typo when applying the patch. Disregard #26.

HS’s picture

+1

Iritscen’s picture

I know I'm coming in late here, but yeah, this should have been grounds for a re-release of the module.

haeger’s picture

You think you're late? I waited with updating this since I didn't want any problems when upgrading, hoping that others would find issues and fix them before I started my upgrade. It's said in the module page that the patch isn't needed but I have the same issue as you guys.

haeger’s picture

Hi again.
Forgot to say that the patch worked as it should and now I have no issues with CCK.
I still think that the version that's availible for general consumption shouldn't have a known bug in it that requires manual patching, but a solution exists so I'm happy. :-)

Status: Fixed » Closed (fixed)

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

misanthropisht’s picture

Great thanks.
I wish the release notes had mentioned this because I haven't the faintest clue about applying patches in Drupal and I am sure I can't be alone in this.

Simplified fix instructions:
Open userreference.install and replace

function userreference_update_6002() {
   $ret = array();

With

function userreference_update_6002() {
   $ret = array();
+ drupal_load('module', 'content');

It's utter madness that this hasn't been packaged into a new release.

HS’s picture

I agree! In my case don't want to go through process of patching it. I've never tried it and don't want to screw things up on a live site either.

Utter madness all right!

HS’s picture

Status: Closed (fixed) » Active
markus_petrux’s picture

Status: Active » Closed (fixed)

This is fixed in CVS. Applying the patch means all you need to do is add one line of code manually.

If you do not want to patch, oh well... you can install the 6.x-2.x-dev release.

A new release will be created as soon as possible, but that depends on something we are coordinating internally and it has not been faster because we are all busy.

Crell’s picture

Status: Closed (fixed) » Needs work

markus, if you're not going to roll a new release immediately please at least provide a patch file rather than manual instructions on how to change the code. That is not a patch.

Although it's now been a month, so I think a new release is appropriate to consider.

Crell’s picture

Here's what I think is a proper patch file for this fix.

Anonymous’s picture

As you can see by the date of this post this patch ( in post #33) still needed to be added to the userreference.install file as I was getting the same errors as the users above.

I'm disappointed that this module has not been updated with this patch, I just wasted one hour troubleshooting this. Let's hope the developer makes the changes asap so we can get on with development etc.

Encarte’s picture

subscribe

ajayg’s picture

Status: Needs work » Reviewed & tested by the community

I have tried the patch and it seems to be working fine.

Crell’s picture

The patch was already committed. The maintainer just needs to roll a 2.7 release with it to fix this issue.

KarenS’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in cvs and a new release is coming, so closing this issue.

Status: Fixed » Closed (fixed)

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