Php 8.2 errors: Deprecated function: Creation of dynamic property

Created on 25 January 2024, 10 months ago
Updated 1 March 2024, 9 months ago

Problem/Motivation

When running php 8.2, you run into these deprecation errors when running the seed. Also see the comments for some additional errors.

https://php.watch/versions/8.2/dynamic-properties-deprecated

Deprecated function: Creation of dynamic property Drupal\quant_api\Client\QuantClient::$client is deprecated in Drupal\quant_api\Client\QuantClient->__construct() (line 74 of /opt/drupal/web/modules/contrib/quantcdn/modules/quant_api/src/Client/QuantClient.php)
#0 /opt/drupal/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'Creation of dyn...', '/opt/drupal/web...', 74)
#1 /opt/drupal/web/modules/contrib/quantcdn/modules/quant_api/src/Client/QuantClient.php(74): _drupal_error_handler(8192, 'Creation of dyn...', '/opt/drupal/web...', 74)
#2 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\quant_api\Client\QuantClient->__construct(Object(GuzzleHttp\Client), Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\Logger\LoggerChannelFactory))
#3 /opt/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'quant_api.clien...')
#4 /opt/drupal/web/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php(89): Drupal\Component\DependencyInjection\Container->get('quant_api.clien...')

Steps to reproduce

  • Install/configure Drupal 10.1 on php 8.2
  • Install/configure quant_api
  • Create content
  • Seed content
  • Look at the logs
  • Results: Errors shown above
  • Expected results: No errors in the logs

Proposed resolution

Fix the deprecation.

Remaining tasks

  • Update code
  • Review and test
  • Commit :)

User interface changes

No deprecation errors in the logs.

API changes

Data model changes

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

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

Comments & Activities

  • Issue created by @Kristen Pol
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    abhishek_gupta1 โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    @Kristen Pol, issue is fixed , created Patch. please review the patch file

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Thanks. Fix has been added in GitHub:

    https://github.com/quantcdn/drupal/pull/222

    I still need to test.

  • Issue was unassigned.
  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    There are a few other deprecation errors that are similar so they should be fixed here as well. Please check the code for anything that's been missed.

    Deprecated function: Creation of dynamic property Drupal\quant_api\Form\SettingsForm::$client is deprecated in Drupal\quant_api\Form\SettingsForm->__construct() (line 23 of /var/www/html/web/modules/contrib/quantcdn/modules/quant_api/src/Form/SettingsForm.php)
    #0 /var/www/html/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'Creation of dyn...', '/var/www/html/w...', 23)
    #1 /var/www/html/web/modules/contrib/quantcdn/modules/quant_api/src/Form/SettingsForm.php(23): _drupal_error_handler(8192, 'Creation of dyn...', '/var/www/html/w...', 23)
    
    Deprecated function: Creation of dynamic property Drupal\quant_search\Controller\Search::$client is deprecated in Drupal\quant_search\Controller\Search->__construct() (line 27 of /var/www/html/web/modules/contrib/quantcdn/modules/quant_search/src/Controller/Search.php)
    #0 /var/www/html/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'Creation of dyn...', '/var/www/html/w...', 27)
    #1 /var/www/html/web/modules/contrib/quantcdn/modules/quant_search/src/Controller/Search.php(27): _drupal_error_handler(8192, 'Creation of dyn...', '/var/www/html/w...', 27)
    
    Deprecated function: Creation of dynamic property Drupal\quant_search\Form\SearchIndexForm::$client is deprecated in Drupal\quant_search\Form\SearchIndexForm->__construct() (line 23 of modules/contrib/quantcdn/modules/quant_search/src/Form/SearchIndexForm.php).
    Drupal\quant_search\Form\SearchIndexForm->__construct(Object) (Line: 30)
    Drupal\quant_search\Form\SearchIndexForm::create(Object) (Line: 28)
    
    Deprecated function: Creation of dynamic property Drupal\quant_search\Form\SearchEntitiesForm::$client is deprecated in Drupal\quant_search\Form\SearchEntitiesForm->__construct() (line 23 of modules/contrib/quantcdn/modules/quant_search/src/Form/SearchEntitiesForm.php).
    Drupal\quant_search\Form\SearchEntitiesForm->__construct(Object) (Line: 30)
    Drupal\quant_search\Form\SearchEntitiesForm::create(Object) (Line: 28)
    
  • Assigned to Kristen Pol
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Assigning to myself.

  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Updated PR and tested locally.

  • Status changed to Fixed 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    This has been merged in GitHub and will be synced to the d.o repo as part of the next release.

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

  • Issue was unassigned.
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Unassigning.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA
Production build 0.71.5 2024