Problem/Motivation

Up until today, I was using version 8.x-1.10 with success. I just updated to 2.0.1 and now I have this error when trying to access the image captcha configuration form :

InvalidArgumentException: Class "\Drupal\image_captcha\Form\ImageCaptchaSettingsForm" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).

And in my logs, I have this error :

Warning: include(/var/platforms/preprod/web/modules/contrib/captcha/image_captcha/src/Form/ImageCaptchaSettingsForm.php): Failed to open stream: No such file or directory in include() (line 582 of /var/platforms/preprod/vendor/composer/ClassLoader.php).

I wonder why it is trying to load that file from the wrong folder which should be :

/var/platforms/preprod/web/modules/contrib/captcha/modules/image_captcha/src/Form/ImageCaptchaSettingsForm.php

I have done the db update and cleared the cache but I always get these errors.

I have tried the exact same process on another test site and all is well. I wonder what could be wrong on my main site? Could it be something in my composer.json?

If somebody could help me resolving this, I would be forever grateful!

Thank you.

Steps to reproduce

Upgrade from 8.x-1.10 to 8.x-1.11 or 2.0.1 and visit the image captcha config page.

I uninstalled both the captcha and image_captcha modules from my site and it is still producing these errors when I install them back.

Obviously, there is something not getting cleaned properly during the upgrade and also when uninstalling/installing again.

How can this be fixed?

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork captcha-3375351

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

LeDucDuBleuet created an issue. See original summary.

chrissnyder’s picture

leducdubleuet’s picture

Status: Active » Closed (works as designed)

@ChrisSnyder Indeed, this may explain why I could not go from 1.10 directly to 2.0.1. To make it work in my site, I had to upgrade to 1.11 and then to 2.0.1...

But I found the source of my specific problem!

For some reason, I had 2 conflicting entries in my composer.json.

One for the captcha module :

"drupal/captcha": "^1.10",

And one for the image_captcha module :

"drupal/image_captcha": "^1.9",

I have no idea why it was like that... :-|

Once the second extra one removed, I updated the module again from 1.10 to 1.11 and then to 2.0.1.

All is well now, sorry for the lost bandwidth, it seems my problem was not directly caused by the upgrade.

Thank you for a great module!

chrissnyder’s picture

Status: Closed (works as designed) » Needs work

I am re-opening this issue because i still think it is still an issue.

leducdubleuet’s picture

No problem, sorry for closing it in the meantime.

anybody’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#3375400: captcha_update_8906 hook updating core.extension.yml incorrectly

Closing this as duplicate of #3375400: captcha_update_8906 hook updating core.extension.yml incorrectly which has a clearer focus. But the MR here is more complete than the one in that issue. Could you please update the other MR?

#3 is really strange, should have never worked. Wild thing.

anybody’s picture

I incorporated the code into the other issue and credited ChrisSnyder! Thanks!