Comments

naveenvalecha created an issue. See original summary.

sreenivasparuchuri’s picture

Assigned: Unassigned » sreenivasparuchuri

I am going to work on it.Assigning to myself.

naveenvalecha’s picture

Assigned: sreenivasparuchuri » Unassigned
Status: Active » Needs review
StatusFileSize
new354 bytes

This will make the module compatible with the Drupal 9 too.

berdir’s picture

Status: Needs review » Needs work

Thanks for starting this, the composer.json should also get the drupal/core dependency with the same definition.

There also still lots of deprecated code usages, ->url() calls, Unicode:: method calls, drupal_set_message(), simpletest tests and so on.

berdir’s picture

Issue tags: +Drupal 9 compatibility
WidgetsBurritos’s picture

Tagging for ContributionWeekend2020 as this may be a good candidate for making progress this weekend.

ankush_03’s picture

StatusFileSize
new887 bytes

Adding Compatibility patch only for info and composer file !

rksyravi’s picture

Status: Needs work » Needs review

Hi,
The patch is working fine. Please review.

ankush_03’s picture

Issue tags: +GCWIndia2020
akashkumar07’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good to me. Moving to RTBC.
Thanks

WidgetsBurritos’s picture

Status: Reviewed & tested by the community » Needs work

I'm still seeing a few deprecation issues here:

$ bin/drupal-check -d docroot/modules/contrib/captcha
 32/32 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------------------------- 
  Line   src/Tests/CaptchaSessionReuseAttackTestCase.php                                        
 ------ --------------------------------------------------------------------------------------- 
  16     Class Drupal\captcha\Tests\CaptchaSessionReuseAttackTestCase extends deprecated class  
         Drupal\simpletest\WebTestBase:                                                         
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                             
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.            
  70     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:              
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                             
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.            
 ------ --------------------------------------------------------------------------------------- 
iyyappan.govind’s picture

StatusFileSize
new1.6 KB
new642 bytes

Hi Folks, Removed the deprecated usage in captcha module test. Please review it.

iyyappan.govind’s picture

Status: Needs work » Needs review
WidgetsBurritos’s picture

Status: Needs review » Needs work

Test failures need to be resolved:

1) Drupal\captcha\Tests\CaptchaSessionReuseAttackTestCase::testCaptchaSessionReuseAttackDetectionOnCommentPreview
Error: Cannot use object of type Behat\Mink\Element\NodeElement as array

/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:189
/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:289

2) Drupal\captcha\Tests\CaptchaSessionReuseAttackTestCase::testCaptchaSessionReuseAttackDetectionOnNodeForm
Error: Cannot use object of type Behat\Mink\Element\NodeElement as array

/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:189
/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:331

3) Drupal\captcha\Tests\CaptchaSessionReuseAttackTestCase::testCaptchaSessionReuseAttackDetectionOnLoginForm
Error: Cannot use object of type Behat\Mink\Element\NodeElement as array

/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:189
/var/www/html/modules/contrib/captcha/src/Tests/CaptchaSessionReuseAttackTestCase.php:372

andreyjan’s picture

Status: Needs work » Needs review
StatusFileSize
new22.66 KB
new21.79 KB

Moved CaptchaSessionReuseAttackTestCase to the tests directory and fixed failing tests.

lestat’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested.

iyyappan.govind’s picture

jeroent’s picture

Status: Reviewed & tested by the community » Needs work

Running the tests still result in a couple of deprecation notices:

Remaining deprecation notices (70)

  46x: Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was captcha_pre_render_process. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725
    8x in CaptchaTest::testCaseInsensitiveValidation from Drupal\Tests\captcha\Functional
    6x in CaptchaCacheTest::testCacheTags from Drupal\Tests\captcha\Functional
    6x in CaptchaPersistenceTest::testPersistencePerFormInstance from Drupal\Tests\captcha\Functional
    5x in CaptchaPersistenceTest::testPersistenceAlways from Drupal\Tests\captcha\Functional
    5x in CaptchaPersistenceTest::testPersistencePerFormType from Drupal\Tests\captcha\Functional
    4x in CaptchaPersistenceTest::testPersistenceOnlyOnce from Drupal\Tests\captcha\Functional
    3x in CaptchaAdminTest::testUntrustedUserPosting from Drupal\Tests\captcha\Functional
    3x in CaptchaTest::testCaptchaOnLoginForm from Drupal\Tests\captcha\Functional
    2x in CaptchaTest::testCaptchaOnLoginBlockOnAdminPagesIssue893810 from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPlacementCacheClearing from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaDescriptionAfterCommentPreview from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaSessionReuseOnNodeForms from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testLongFormId from Drupal\Tests\captcha\Functional

  20x: Drupal\Tests\BrowserTestBase::$defaultTheme is required in drupal:9.0.0 when using an install profile that does not set a default theme. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.
    1x in CaptchaPersistenceTest::testPersistenceAlways from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaOnLoginBlockOnAdminPagesIssue893810 from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaSessionReuseOnNodeForms from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaDescriptionAfterCommentPreview from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaseInsensitiveValidation from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testCaptchaOnLoginForm from Drupal\Tests\captcha\Functional
    1x in CaptchaPersistenceTest::testPersistenceOnlyOnce from Drupal\Tests\captcha\Functional
    1x in CaptchaPersistenceTest::testPersistencePerFormType from Drupal\Tests\captcha\Functional
    1x in CaptchaPersistenceTest::testPersistencePerFormInstance from Drupal\Tests\captcha\Functional
    1x in CaptchaCronTest::testCron from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testAdminAccess from Drupal\Tests\captcha\Functional
    1x in CaptchaCacheTest::testCacheTags from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPointAdministrationByNonAdmin from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPointAdministration from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPlacementCacheClearing from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testXssOnCaptchaDescription from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testUntrustedUserPosting from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaAdminLinks from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPointSettingGetterAndSetter from Drupal\Tests\captcha\Functional
    1x in CaptchaTest::testLongFormId from Drupal\Tests\captcha\Functional

  4x: Support for asserting against non-boolean values in ::assertFalse is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertEmpty(). See https://www.drupal.org/node/3082086
    3x in CaptchaCacheTest::testCacheTags from Drupal\Tests\captcha\Functional
    1x in CaptchaAdminTest::testCaptchaPointAdministration from Drupal\Tests\captcha\Functional
berdir’s picture

  1. +++ b/captcha.info.yml
    @@ -3,6 +3,7 @@ type: module
     core: 8.x
    +core_version_requirement: ^8 || ^9
     configure: captcha_settings
    

    some of the remaining deprecations require 8.8. If we do fix them there and not create a follow-up then this needs to be changed to ^8.8 || ^9.

  2. +++ b/composer.json
    @@ -1,5 +1,12 @@
    +  },
    +  "require": {
    +    "drupal/core": "^8.0 || ^9.0"
    +  }
    

    there is no neeed anymore for this, it's easier to skip composer.json changes.

dhirendra.mishra’s picture

Assigned: Unassigned » dhirendra.mishra

I am working on this.

dhirendra.mishra’s picture

Assigned: dhirendra.mishra » Unassigned
Status: Needs work » Needs review
StatusFileSize
new583 bytes
new22.6 KB

Status: Needs review » Needs work

The last submitted patch, 21: 3102288-21.patch, failed testing. View results

swatichouhan012’s picture

Status: Needs work » Needs review
Issue tags: +VbContribution2020
StatusFileSize
new22.62 KB
new306 bytes

If we are using min version 8.8 then we need to remove core key from info file right ? See https://www.drupal.org/node/3070687

iyyappan.govind’s picture

If we are using min version 8.8 then we need to remove core key from info file right ? See https://www.drupal.org/node/3070687

Yes but the CAPTCHA module will support the earlier versions of Drupal 8. So we need to keep the core key in the info file other wise module will not detected on Drupal Core Version < D8.7.7.

wundo’s picture

Why not commit this in a separated branch? (I can create it)

berdir’s picture

It's not allowed to have ^8.8 and the old core key, if you require 8.8 then it is by design that older versions can't detect that anymore because they're not compatible.

I would vote against an 8.x-2.x branch for this, that creates considerable long-term maintenance overhead, and marking the old one as unsupported soon-ish would then force users to update as they get unsupported warnings. My approach is simply to wait until I decide to drop 8.7 support, which I plan to do for my modules that require 8.8 around march.

wundo’s picture

I was actually thinking of creating a 9.x branch not 8.x-2.x

berdir’s picture

That's not possible, d.o does not allow that. Instead, the 8.x- prefix will eventually go away and you'll be able to create an 2.x.y branch. But that will take some more time to become available.

wundo’s picture

Got it, so let's leave it the way its.

Thanks for your help Berdir

iyyappan.govind’s picture

@Berdir, I agree with your point. Thanks for the clarification.

berdir’s picture

StatusFileSize
new31.67 KB
new9.05 KB

Found a pre render callback that we need to move to a trusted callback, that just works on the Captcha class because it's a render plugin and all their methods are trusted becuase inherits from \Drupal\Core\Render\Element\RenderCallbackInterface through ElementInterface. I did keep the old function place in case someone calls it directly, that doesn't seem to be the case in contrib: grep.xnddx.ru/search?text=captcha_pre_render_process, so feel free to remove it if you don't think that's an official API from this module.

Also added the defaultTheme property and some assertTrue/False fixes, this is now passing all tests locally without remaining deprecation messages. I did improve some asserts related to those changes, e.g. using find() instead of xpath with a selector that works with the stark theme.

berdir’s picture

StatusFileSize
new32.69 KB
new1.01 KB

Two modules were missing the core_version_requirement key.

lisa.rae’s picture

Related issues: +#3121316: Compatibility with Drupal 9
StatusFileSize
new12.04 KB
new23.76 KB

Looks like a previously closed, duplicate issue was merged anyway.

Rerolling this patch to remove the duplicated code, I hope I caught everything.

Status: Needs review » Needs work

The last submitted patch, 33: 3102288-33.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

lisa.rae’s picture

neslee canil pinto’s picture

Status: Needs work » Needs review
StatusFileSize
new25.23 KB

Status: Needs review » Needs work

The last submitted patch, 36: 3102288-36.patch, failed testing. View results

neslee canil pinto’s picture

Status: Needs work » Needs review
kim.pepper’s picture

@Neslee Canil Pinto can you please post interdiff files? Without them, it makes it difficult to see what's changed between patches.

kim.pepper’s picture

StatusFileSize
new32.69 KB

This is just a re-roll of #32 I don't know what the patches following that are doing.

gaëlg’s picture

Automated tests passed and drupal-check found no problem. What's still needed for RTBC?

gambry’s picture

Status: Needs review » Reviewed & tested by the community

Upgrade status scan doesn't find any more issue, patch on #40 applies nicely to 1.0 too. RTBCed.

heddn’s picture

Status: Reviewed & tested by the community » Needs work

I think we need to put a composer require section into the composer.json for ^8.8 || ^9.0. Otherwise someone might try to install the site on 8.7 and run into issues where composer didn't know about the stricter requirements that Drupal has outlined in the info.yml file.

berdir’s picture

Status: Needs work » Reviewed & tested by the community

Same as #3042808: Drupal 9 Deprecated Code Report, that's not necessary unless it already has a conflicting definition. Not doing it avoids mistakes in the future, like i I did for token.module where I forgot to update it when changing .info.yml :)

adrianpintilie’s picture

I understand that the code passed RTBC and the last comment isn't required. Who can move this forward as a release for D9? It might be an issue for many sites as they will try to upgrade to D9.

  • japerry committed c4bfbde on 8.x-1.x authored by kim.pepper
    Issue #3102288 by Berdir, iyyappan.govind, dhirendra.mishra, lhridley,...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Ran through the tests, this works great. Committed just in time for D9!

Status: Fixed » Closed (fixed)

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