Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When we run update after upgrade to 7.x-2.4 from 7.x-2.2, getting below update_Ns:
Wysiwyg 7201 Update enabled font plugin buttons to default plugin in
TinyMCE profiles.
Wysiwyg 7202 Update internal names of settings.
Wysiwyg 7203 Add primary index to {wysiwyg_user}.
Wysiwyg 7204 Remove empty editor profiles and update existing profiles.
Wysiwyg 7205 Check for profiles without add_to_summaries settings.
Do you wish to run all pending updates? (y/n): y
Ran up to 7203 successfully. After throws fatal error:
Performed update: wysiwyg_update_7201 [ok]
Performed update: wysiwyg_update_7202 [ok]
Performed update: wysiwyg_update_7203 [ok]
Fatal error: Class name must be a valid object or a string in includes/common.inc on line 8048
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class name must be a valid object or a string in includes/common.inc, line 8048
The external command could not be executed due to an application [error]
error.
Proposed resolution
Remaining tasks
- Fix
- Review
- Test
Comment | File | Size | Author |
---|---|---|---|
#10 | wysiwyg.install-exception.2878771.10.patch | 620 bytes | TwoD |
#9 | 0001-HOTFIX-patch-WYSIWYG-module-s-update-hook-fatal-erro.patch | 4.72 KB | alexharries |
Comments
Comment #2
TwoDTry clearing all caches and run the update again, or maybe even rebuild the class rregistry with drush rr.
Comment #3
bondjimbond CreditAttribution: bondjimbond as a volunteer commentedI'm getting a similar error with that update in the browser:
Call to undefined function wysiwyg_profile_cache_clear()
Comment #4
jcazotto CreditAttribution: jcazotto at CI&T commentedI've tried to run drush rr --fire-bazooka and drush cc all, but I'm still getting the same fatal error when running updb.
It seems that this error occurs only if Wysiwyg is disabled. It doesn't happen if module is enabled or uninstalled.
Comment #5
TwoDOh, that explains it. If the module is disable the .module file will not be loaded, and thus it's not able to load the classes from there.
I don't know why Drupal allows updating disabled modules, it is bound to cause problems...
There does not seem to be a way to resolve this as there is already a line in that update hook which tries to load wysiwyg.module.
(I can't say for certain it's not trying to load some other class than the one available there though, as the error message doesn't actually include its name.)
Basically, my advice is; if you've disabled a module, don't try to update it without enabling it first. If you don't want to enable it, either uninstall it or don't upgrade. D8 does away with all these issues by forcing modules to be completely uninstall once disabled.
Comment #6
vijaycs85Sorry, my bad, I didn't mention about the disabled status. More background why are we running disabled modules update is available at #194310: Check / run updates of disabled modules. As you mentioned, we end up enabling/uninstalling the module.
Comment #7
vijaycs85Closing this issue as won't fix.
Comment #8
alexharries CreditAttribution: alexharries commentedI would like to re-open this as I've just spent 3 hours diagnosing why this was happening.
I can see that this isn't really the fault of the module developer, but it can be fixed at the module level:
Surely you only need to put "if (module_exists('wysiwyg')) {' at the top of the wysiwyg_update_7204() function?
This has caused a huge and unnecessary headache and made me very grumpy :( :)
/Alex
Comment #9
alexharries CreditAttribution: alexharries commentedApologies - I don't have the bits and bobs set up to produce a diff against HEAD but here's
wysiwyg_update_7104()
with themodule_exists()
fix applied:Comment #10
TwoDIf I do that and someone runs an upgrade, and then enables Wysiwyg, it won't be run again if they activate the module as Core keeps track of which hook numbers have already run, putting the db in a state I'm not sure how to resolve. By that time you may not get any errors at all, just odd behavior.
It's already doing
drupal_load('module', 'wysiwyg')
so all Wysiwyg's classes are technically available at this point. The problem seems to be thatentity_get_info()
returns null if the module owning the entity isn't enabled, so Drupal after tries to loadnull
as the controller class for Wysiwyg profiles. (This actually happens when trying to clear profile caches.)What if we instead simply skip trying to clear the controller's cache if the module isn't enabled?
Comment #11
axle_foley00 CreditAttribution: axle_foley00 commentedI am happy I found this. I was getting the same error and enabling the module helped.
Comment #12
eg2234 CreditAttribution: eg2234 commentedI'm getting a similar error:
SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined
WYSIWYG is enabled, and I've tried disabling, clearing cache, and re-enabling without success.
Comment #13
Aldu_boy CreditAttribution: Aldu_boy commentedWith Drupal 7.69 the 7204 update issue is still in place.
Fixed by editing /sites/all/modules/wysiwyg/wysiwyg.module
replaced a line
entity_get_controller('wysiwyg_profile')->resetCache();
with
Comment #14
steinmb CreditAttribution: steinmb as a volunteer and at University Of Bergen commentedComment #16
TwoDThank you all.