PHP 8.2 Deprecated function warnings: Creation of dynamic property enforceDefaultTranslation

Created on 26 February 2024, 9 months ago
Updated 1 July 2024, 5 months ago

Problem/Motivation

In test environments where we have upgraded to PHP 8.2, we are encountering numerous instances of warnings such as this:

Deprecated function: Creation of dynamic property Drupal\user\Entity\User::$enforceDefaultTranslation is deprecated in Drupal\memcache\Driver\MemcachedDriver->getMulti() (line 71 of /var/www/html/docroot/modules/contrib/memcache/src/Driver/MemcachedDriver.php) #0 /var/www/html/docroot/core/includes/bootstrap.inc(164): _drupal_error_handler_real()

We've seen this for the following items:

Drupal\crop\Entity\Crop::$enforceDefaultTranslation
Drupal\dockan\Entity\Bundle\Dataset::$enforceDefaultTranslation
Drupal\dockan\Entity\Bundle\Organization::$enforceDefaultTranslation
Drupal\dockan\Entity\Bundle\Resource::$enforceDefaultTranslation
Drupal\file\Entity\File::$enforceDefaultTranslation
Drupal\media\Entity\Media::$enforceDefaultTranslation
Drupal\menu_item_extras\Entity\MenuItemExtrasMenuLinkContent::$enforceDefaultTranslation
Drupal\node\Entity\Node::$enforceDefaultTranslation
Drupal\paragraphs\Entity\Paragraph::$enforceDefaultTranslation
Drupal\taxonomy\Entity\Term::$enforceDefaultTranslation
Drupal\user\Entity\User::$enforceDefaultTranslation

Steps to reproduce

1. Enable memcache along with other modules
2. upgrade to PHP 8.2

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom malcomio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @malcomio
  • Assigned to chetan 11
  • Merge request !25fixed → (Open) created by chetan 11
  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇳India chetan 11

    Please check the above MR.

  • Pipeline finished with Failed
    9 months ago
    Total: 162s
    #104134
  • 🇺🇸United States parkh

    After I applied the patch, I got this error from drush while running drush cr:
    [warning] Attempt to read property "created" on null MemcacheBackend.php:152

  • First commit to issue fork.
  • Assigned to ankitv18
  • Status changed to Needs work 6 months ago
  • 🇮🇳India ankitv18

    MR!25 work isn't appropriate as the issue reported.

  • Issue was unassigned.
  • Status changed to Closed: works as designed 6 months ago
  • 🇮🇳India ankitv18

    Checked on my and I also worked on another issue where pipeline isn't reported deprecation due to dynamic property.
    PHPStan Pipeline: https://git.drupalcode.org/issue/memcache-3368578/-/jobs/158840

  • achap 🇦🇺

    I saw this as well.

    Steps to reproduce:

    1. Enable PHP8.2 on your environment.
    2. Switch to a branch running core 10.2 (where enforceDefaultTranslation is added to ContentEntityBase).
    3. Clear cache (no warnings).
    4. Switch to a branch running core 10.1 (no enforceDefaultTranslation).
    5. Clear cache (warnings).

    But don't think this is an issue with this module.

  • 🇺🇸United States couloir007

    By this being closed works as designed mean there is no issue? I started seeing this as soon as we upgraded to PHP 8.2, which to me makes it seem like there is a real issue.

Production build 0.71.5 2024