PHP Fatal error: Cannot redeclare filefield_token_list() (previously declared in /var/www/servers/ap24/version2/sites/all/modules/filefield/filefield_token/filefield_token.module:7) in /var/www/servers/ap24/version2/sites/all/modules/filefield/filefield.token.inc on line 29

Comments

bennos’s picture

sorry there is an "a" missing in the title.
WOD with upgrade from beta3 to Rc1

quicksketch’s picture

Title: WOD with upgrade from bet3 to Rc1 » Cannot redeclare filefield_token_list()
Category: bug » support

The FileField Token module has been removed, it's now just filefield.token.inc. Just delete the filefield_token directory. It's not part of the tarball, perhaps you updated via CVS but didn't use the '-d' option to delete old files?

quicksketch’s picture

Status: Active » Fixed
bennos’s picture

no, only copied the RC1 over the existing module.

will wipe it out and and move to RC1.

thx

toddtomlinson’s picture

Same problem as mentioned by others above. I downloaded the latest from Drupal.org -- uploaded and had the Cannot redeclare filefield_token_list() error. I'm sure that a lot of people are going to have the same problem.

jdlind38’s picture

Same issue

bennos’s picture

Ok. delete the beta3 and then copy the rc1 in the modules folder. this works.

quicksketch’s picture

Yes, please replace the entire module directory. Updating only certain files sounds like something that will get you into trouble.

mudd’s picture

Is FileField Token compatable with FileField-3.0-RC1?

Here and in thread #421556: fatal error Cannot redeclare filefield_token_list folks keep saying "delete FF foleder before replacing it with RC1" -- I think meaning to convey that Token is causing the problem and should be removed. To that I say, sure, when we upgrade something like CCK or FF we're going to replace the each sub module (e.g. FF-Token) unless you tell us 1) there's an incompatibility, 2) all the functionality of Token is included elesewhere (and tell us where) so don't reinstall it, and 3) include this statement in a formal format, say in the release notes.

Thanks.

mudd’s picture

Status: Fixed » Active

Reopening.

quicksketch’s picture

Status: Active » Fixed

I've updated the release notes with a note about FileField Token.

Important upgrade note: The "FileField Token" module has been merged back into FileField so that it is no longer a separate module. When upgrading, delete the filefield_token directory entirely. All the functionality of filefield_token is now included in filefield.token.inc.

Token (token.module) is not causing a problem. You just need to delete the filefield_token directory since this module is no longer needed.

Here's a good post about properly updating a module:
http://groups.drupal.org/node/19513

Unfortunately I couldn't find any real good doc pages, but the basic procedure:

- Delete the old module directory
- Upload the new module directory
- Run update.php

Do not simply untar the new version into the old module directory. For as people are noticing, this doesn't account for when a file is deleted or renamed.

awolfey’s picture

I think this version needs to uninstall the file_field token module through update.php to remove it from the system table, or it will be there forever.

quicksketch’s picture

awolfey: filefield.install does do this:

  $ret[] = update_sql("DELETE FROM {system} WHERE type = 'module' AND name = 'filefield_token'");
awolfey’s picture

OK. I must have screwed something up.

madlee’s picture

thanks.

Patroclas’s picture

I have a serious problem with this. I got the above error upgrading from 6.x-3.0-alpha7 to 6.x-3.0-rc1. I deleted the filefield folder and uninstalled the module. Then uploaded 6.x-3.0-rc1. I am now getting this error
Call to undefined function filefield_elements() in \sites\all\modules\imagefield\imagefield.module on line 84
and can't get into admin.
I have also attempted to upgrade imagefield from 6.x-3.0-beta2 to 6.x-3.0-rc1 to see if that helped but no.
This is on my local test site, but I do have a production site running the same versions (yes, I know, maybe I shouldn't) so I do need to get this sorted out.
I would be very grateful for any help.

quicksketch’s picture

I deleted the filefield folder and uninstalled the module.

You uninstalled the module when upgrading!? That's extremely dangerous, you very well could delete all the FileField content on your site. You don't need to uninstall or disable a module when updating (nor should you). See the directions in #11.

It sounds like you somehow have ImageField installed but not FileField now. You can try manually disabling ImageField by setting the status column to "0" in the system database table, then emptying the cache database table. That should let you access admin/build/modules and turn back on both modules, then run update.php.

Patroclas’s picture

Thanks for your reply quicksketch. Yes I know that was stupid.

I managed to roll back my test site and then do the upgrade properly as suggested. I had got into bad habits not deleting the module folder before uploading the new version. Thanks again.

quinti’s picture

buahs..., thanks....

i'ts very dangerous..., only activating "FileField Tokens 6.x-3.0-alpha7 - Token Integration for FileField."
the system down....

thank you very much

AlexisWilke’s picture

Note, I bump in the same issue and deleting and re-extracting the tarball fixed it immediately. 8-)

Thank you.
Alexis

Status: Fixed » Closed (fixed)

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

artefatta’s picture

Got the same issue:
Thanks, deleting the filefield_token directory helped me.

ClearXS’s picture

Might have found the solution for new installs:
http://drupal.org/node/787334

rikimaru0007’s picture

All the functionality of filefield_token is now included in filefield.token.inc.

Thank you Sir quicksketch for this simple explanation that solved my problem.