Problem/Motivation

#2712647: Update Symfony components to ~3.2 updated the Symfony components to 3.2.

One of the deprecations that Symfony 3.2 introduced, was Request::isMethodSafe(). We must now use Request::isMethodCacheable().

Since #2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code, deprecations cause failures. Which means that now the following tests fail:

  1. JsonApiFunctionalTest::testWrite()

Proposed resolution

Use Request::isMethodCacheable(). This will work with Drupal 8.4 and later. It won't work in Drupal 8.3, but that is insecure/unsupported for a while now already.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#3 2926415-3.patch1.55 KBwim leers

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Title: Request::isMethodSafe() is deprecated since Symfony 3.2/ » Request::isMethodSafe() is deprecated in Symfony 3.2/Drupal 8.4.0
Related issues: +#2926409: BaseFieldDefinition::setQueryable() is deprecated in Drupal 8.4.0
wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.55 KB
wim leers’s picture

Status: Needs review » Reviewed & tested by the community
HEAD
Testing Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTest
..

Time: 18.97 seconds, Memory: 4.00MB

OK (2 tests, 134 assertions)

Remaining deprecation notices (67)

\Drupal\Core\Routing\Enhancer\RouteEnhancerInterface is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Routing\EnhancerInterface. See https://www.drupal.org/node/2894934: 51x
    30x in JsonApiFunctionalTest::testRead from Drupal\Tests\jsonapi\Functional
    21x in JsonApiFunctionalTest::testWrite from Drupal\Tests\jsonapi\Functional

Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead: 16x
    16x in JsonApiFunctionalTest::testWrite from Drupal\Tests\jsonapi\Functional
<dt>Patch</dt>
<dd><code>Testing Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTest
..

Time: 19.01 seconds, Memory: 4.00MB

OK (2 tests, 134 assertions)

Remaining deprecation notices (51)

\Drupal\Core\Routing\Enhancer\RouteEnhancerInterface is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Routing\EnhancerInterface. See https://www.drupal.org/node/2894934: 51x
    30x in JsonApiFunctionalTest::testRead from Drupal\Tests\jsonapi\Functional
    21x in JsonApiFunctionalTest::testWrite from Drupal\Tests\jsonapi\Functional

  • Wim Leers committed bf71fd0 on 8.x-1.x
    Issue #2926415 by Wim Leers: Request::isMethodSafe() is deprecated in...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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