Problem/Motivation
PHP 8.2 deprecated dynamic properties (creating class properties on-the-fly without declaring them). The Drupal\entity_sync\DelayedExecutor\Executor class assigns $this->exportManager and $this->queueManager in the constructor without declaring these properties, causing deprecation warnings:
Deprecated function: Creation of dynamic property Drupal\entity_sync\DelayedExecutor\Executor::$queueManager is deprecated
Steps to reproduce
1. Run PHP 8.2 or higher
2. Enable entity_sync module
3. Trigger any action that instantiates the DelayedExecutor\Executor service
4. Observe deprecation warning in logs
Proposed resolution
Add explicit property declarations to the Executor class:
/**
* The Entity Synchronization entity export manager.
*
* @var \Drupal\entity_sync\Export\EntityManagerInterface
*/
protected $exportManager;
/**
* The Entity Synchronization queue manager.
*
* @var \Drupal\entity_sync\Queue\ManagerInterface
*/
protected $queueManager;
Comments
Comment #2
shabana.navas commentedPatch.
Comment #3
shabana.navas commentedMore deprecation warnings.
Comment #4
shabana.navas commentedComment #5
vinodhini.e commentedHi,
Tested this issue on Drupal 10.6.10 with PHP 8.4 and was able to reproduce the deprecation error described in the issue summary. Applied the patch and retested. The deprecation error are no longer displayed, and its working as expected.
Thanks.
Comment #6
jsacksick commentedJust noting that the changes from this issue were also blended in https://git.drupalcode.org/project/entity_sync/-/merge_requests/70 which introduces D11 support and fix similar issues in other places.
Comment #9
krystalcode commentedComment #13
jsacksick commented@krystalcode: The indentation is off in this commit https://git.drupalcode.org/project/entity_sync/-/commit/8bf94d7bdafcc601...
4 spaces instead of 2.