Problem/Motivation

\Drupal\Core\Field\BaseFieldDefinition::getPropertyDefinition() causes deprecations on PHP 8.5 because $name is set to NULL.

Steps to reproduce

Run \Drupal\Tests\jsonapi\Kernel\Context\FieldResolverTest::testResolveInternalIncludePath

Proposed resolution

Deprecate calling \Drupal\Core\Field\FieldStorageDefinitionInterface::getPropertyDefinition() with a $name set to NULL

Remaining tasks

User interface changes

None

Introduced terminology

N/a

API changes

Drupal 12 will throw an exception in this case.

Data model changes

None

Release notes snippet

N/a

Issue fork drupal-3557372

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

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review

alexpott’s picture

Issue tags: +Needs tests

Need to add a test for the deprecations...

smustgrave’s picture

Status: Needs review » Needs work

Locally using 8.5.0RC3

Running testResolveInternalIncludePath got 4 tests triggered 1 PHP deprecation:
With the MR got 0

Already see we got the commented out typehints awesome!

Going to move to NW for the tests, but think we need them here? We know these kind of deprecations work

alexpott’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added a test FWIW

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Tests look good.

  • catch committed 0eec8f28 on 11.3.x
    fix: #3557372 \Drupal\Core\Field\BaseFieldDefinition::...

  • catch committed 09cc5264 on 11.x
    fix: #3557372 \Drupal\Core\Field\BaseFieldDefinition::...
catch’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 11.3.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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