Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

StatusFileSize
new2.12 KB

Kindly review a patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review

Status: Needs review » Needs work

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

longwave’s picture

This is covered in #3104307: Remove BC layers in various Drupal\Core components but it might be easier to break that down into multiple patches, not sure

hardik_patel_12’s picture

StatusFileSize
new4.12 KB
new2.09 KB

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
hardik_patel_12’s picture

@longwave , let me go through #3104307: [PP-1] Remove BC layers in various Drupal\Core components , and will check how much they have covered and will create patch accordingly . But I fill it's better to create component wise patch because in large patch all component will gone depend on each other. For example if we have successfully removed deprecated code from Access component but if we are facing some issue in other component then Access component code also stuck.

longwave’s picture

  1. +++ b/core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php
    @@ -53,8 +53,6 @@ public function applies(Route $route) {
         $applicable_requirements = [
           '_csrf_request_header_token',
    -      // @todo Remove _access_rest_csrf in Drupal 9.0.0.
    -      '_access_rest_csrf',
         ];
    

    This probably doesn't need to be an array now it only has one item.

  2. +++ b/core/modules/system/tests/src/Functional/CsrfRequestHeaderTest.php
    @@ -27,8 +27,7 @@ class CsrfRequestHeaderTest extends BrowserTestBase {
    +   * This checks one route that uses _csrf_request_header_token.
    

    This comment can be removed now, it's not helpful any more.

Status: Needs review » Needs work

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

hardik_patel_12’s picture

$applicable_requirements = [
'_csrf_request_header_token',
- // @todo Remove _access_rest_csrf in Drupal 9.0.0.
- '_access_rest_csrf',
];

will used by

if (array_intersect($applicable_requirements, $requirement_keys)) {

and first argument is array.So can we can kept in array.

longwave’s picture

It is much simpler to just say this than use array_intersect() on an array with one item:

if (isset($requirements['_csrf_request_header_token'])) {
hardik_patel_12’s picture

StatusFileSize
new4.38 KB
new868 bytes

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

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

hardik_patel_12’s picture

StatusFileSize
new4.56 KB
new604 bytes

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

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

hardik_patel_12’s picture

StatusFileSize
new4.06 KB
new960 bytes

I have checked logic that $requirement_keys = array_keys($requirements); returns array along with key value format. And if we use $applicable_requirements = '_csrf_request_header_token'; as string then we have to use inArray function to check "_csrf_request_header_token" present or not. So instead of using inArray dunction we can use exisitng array_intersect function which is already used overthere.

hardik_patel_12’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

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

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new11.01 KB
new8 KB
longwave’s picture

+++ b/core/lib/Drupal/Core/Access/AccessResult.php
@@ -278,37 +278,6 @@ public function cachePerUser() {
-  public function cacheUntilEntityChanges(EntityInterface $entity) {
-    return $this->addCacheableDependency($entity);
-  }

This never used trigger_error() or had a test, are we still OK to remove it?

edit: it is used in contrib: http://grep.xnddx.ru/search?text=cacheUntilEntityChanges&filename=

longwave’s picture

_access_rest_csrf was never properly deprecated either and contrib still refers to that too: http://grep.xnddx.ru/search?text=_access_rest_csrf&filename=

longwave’s picture

Status: Needs review » Needs work

As per @Wim Leers in #3104307-16: Remove BC layers in various Drupal\Core components we must properly deprecate cacheUntilEntityChanges() and _access_rest_csrf for removal in D10 rather than removing them now in D9.

berdir’s picture

Lets check with @catch on that before changing the patch. They have been deprecated for a long time and at least for cacheUntilEntityChanges(), that was fairly visible and drupal-check should be able to report that, the route access check might be different.

We've removed other things without @trigger_error() too.

berdir’s picture

And for example at least one of the found usages of _access_rest_csrf is already broken anyway, because it doesn't define that on a route but checks for it on routes, so that's not going to show that output anymore, the BC layer can't work in that direction.

catch’s picture

So I would say ::cacheUntilEntityChanges() is definitely fine to remove. It has @deprecated and a change record. For example it shows up here #3042605: Drupal 9 Deprecated Code Report.

I'm less sure about _access_rest_csrf because there's no way to inform people otherwise, I think we should take that out of the patch and discuss it in a follow-up. Also the runtime support for it is one or two lines.

In both cases we'll need 8.8/8.9 patches to make the deprecation up to current standards - can be separate issues to this one.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new2.8 KB

Removed _access_rest_csrf changes from the patch. No interdiff as the patch is smaller than the interdiff itself.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. This now matches what is in #3104307: Remove BC layers in various Drupal\Core components but that was always meant to deal with leftovers and needs more work and what's done is done.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9f83de2 and pushed to 9.0.x. Thanks!

  • catch committed b978479 on 9.0.x
    Issue #3110296 by Hardik_Patel_12, longwave, Berdir: Remove all @...
catch’s picture

Thanks for opening the spin-offs, committed #3111504: Properly deprecate AccessResult::cacheUntilEntityChanges() to 8.9.x and 8.8.x just before this one.

wim leers’s picture

Nice work here! :)

Status: Fixed » Closed (fixed)

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