Deprecated function: Creation of dynamic property Drupal\zoomapi\Plugin\ApiTools\Client::$id is deprecated

Created on 13 December 2023, about 1 year ago

Deprecated function: Creation of dynamic property Drupal\zoomapi\Plugin\ApiTools\Client::$id is deprecated with PHP 8.2

๐Ÿ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡พBelarus dewalt

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Merge Requests

Comments & Activities

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

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

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    @dewalt, I have fixed the issue. please kindly review the MR

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    I need more information. Can you post a code example that was causing the deprecated function? Zoom API Module and APITools are not setting an $id property. Are you setting one?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

    I installed and enabled and have not setup the zoomapi module.

    Here is what I get:

    ttps://mysite/admin/commerce/config||1||Deprecated function: Creation of dynamic property Drupal\zoomapi\Plugin\ApiTools\Client::$id is deprecated in Drupal\Component\DependencyInjection\Container->createService() (line 285 of drupal10.2.4/html/core/lib/Drupal/Component/DependencyInjection/Container.php) #0 drupal10.2.4/html/core/includes/bootstrap.inc(164): _drupal_error_handler_real()
    Mar 7 14:01:17 mysite drupal: #1 drupal10.2.4/html/core/lib/Drupal/Component/DependencyInjection/Container.php(285): _drupal_error_handler()
    Mar 7 14:01:17 mysite drupal: #2 drupal10.2.4/html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    Mar 7 14:01:17 mysite drupal: #3 drupal10.2.4/html/core/lib/Drupal.php(197): Drupal\Component\DependencyInjection\Container->get()
    Mar 7 14:01:17 mysite drupal: #4 drupal10.2.4/html/modules/contrib/zoomapi/zoomapi.install(17): Drupal::service()
    Mar 7 14:01:17 mysite drupal: #5 [internal function]: zoomapi_requirements()
    Mar 7 14:01:17 mysite drupal: #6 drupal10.2.4/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array()
    Mar 7 14:01:17 mysite drupal: #7 drupal10.2.4/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
    Mar 7 14:01:17 mysite drupal: #8 drupal10.2.4/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(408): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    Mar 7 14:01:17 mysite drupal: #9 drupal10.2.4/html/core/modules/system/src/SystemManager.php(109): Drupal\Core\Extension\ModuleHandler->invokeAll()
    Mar 7 14:01:17 mysite drupal: #10 drupal10.2.4/html/core/modules/system/src/SystemManager.php(93): Drupal\system\SystemManager->listRequirements()
    Mar 7 14:01:17 mysite drupal: #11 drupal10.2.4/html/core/modules/system/src/Controller/SystemController.php(123): Drupal\system\SystemManager->checkRequirements()
    Mar 7 14:01:17 mysite drupal: #12 [internal function]: Drupal\system\Controller\SystemController->overview()
    Mar 7 14:01:17 mysite drupal: #13 drupal10.2.4/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    Mar 7 14:01:17 mysite drupal: #14 drupal10.2.4/html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    Mar 7 14:01:17 mysite drupal: #15 drupal10.2.4/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
    Mar 7 14:01:17 mysite drupal: #16 drupal10.2.4/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    Mar 7 14:01:17 mysite drupal: #17 drupal10.2.4/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    Mar 7 14:01:17 mysite drupal: #18 drupal10.2.4/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    Mar 7 14:01:17 mysite drupal: #19 drupal10.2.4/html/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(54): Symfony\Component\HttpKernel\HttpKernel->handle()
    Mar 7 14:01:17 mysite drupal: #20 drupal10.2.4/html/modules/contrib/bat_api/src/StackMiddleware/BatApiMiddleware.php(39): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle()
    Mar 7 14:01:17 mysite drupal: #21 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\bat_api\StackMiddleware\BatApiMiddleware->handle()
    Mar 7 14:01:17 mysite drupal: #22 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    Mar 7 14:01:17 mysite drupal: #23 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    Mar 7 14:01:17 mysite drupal: #24 drupal10.2.4/html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    Mar 7 14:01:17 mysite drupal: #25 drupal10.2.4/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    Mar 7 14:01:17 mysite drupal: #26 drupal10.2.4/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    Mar 7 14:01:17 mysite drupal: #27 drupal10.2.4/html/modules/contrib/services/src/StackMiddleware/FormatSetter.php(45): Drupal\page_cache\StackMiddleware\PageCache->handle()
    Mar 7 14:01:17 mysite drupal: #28 drupal10.2.4/html/modules/contrib/webform_product/src/RedirectMiddleware.php(43): Drupal\services\StackMiddleware\FormatSetter->handle()
    Mar 7 14:01:17 mysite drupal: #29 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\webform_product\RedirectMiddleware->handle()
    Mar 7 14:01:17 mysite drupal: #30 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    Mar 7 14:01:17 mysite drupal: #31 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    Mar 7 14:01:17 mysite drupal: #32 drupal10.2.4/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    Mar 7 14:01:17 mysite drupal: #33 drupal10.2.4/html/core/lib/Drupal/Core/DrupalKernel.php(714): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    Mar 7 14:01:17 mysite drupal: #34 drupal10.2.4/html/index.php(19): Drupal\Core\DrupalKernel->handle()
    Mar 7 14:01:17 mysite drupal: #35 {main}.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

    The MR yields another error:

    /admin/reports/status|https://onebayview.com/|1||Error: Cannot access protected property Drupal\zoomapi\Plugin\ApiTools\Client::$id in Drupal\Component\DependencyInjection\Container->createService() (line 285 of /drupal10.2.4/html/core/lib/Drupal/Component/DependencyInjection/Container.php).

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    Thanks @SocialNicheGuru! So just confirming that this is a PHP 8.2 issue?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gokul.jayan

    @joelsteidl โ†’

    Hi, The deprecation error is invoked because the id is passed to the set property in the Service alter function.

     public function alter(ContainerBuilder $container) {
        if ($container->hasDefinition('apitools.client_base')) {
          $definition = new ChildDefinition('apitools.client_base');
          $definition->setClass('Drupal\zoomapi\Plugin\ApiTools\Client')
            ->addArgument('zoomapi')
            ->setProperty('id', 'zoomapi.client');
          // Add the definition to the container.
          $container->setDefinition('zoomapi.client', $definition);
        }
      }
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    The major issue here was trying to handle the use case where a user was coming from 2.x to 3.x and did not have apitools enabled . They couldn't get past the whitescreen of death.

    I think the merge request handles that and the original issue reported.

    I'd love any testing that folks can offer.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia u_tiwari

    Tested the patch locally with version: '3.0.0-alpha3', seems to get rid of the error

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

    With the patch I now get a different error

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function Drupal\Core\StreamWrapper\StreamWrapperManager::__construct(), 0 passed and exactly 1 expected in drupal-10.3.x/html/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php:21
    Stack trace:
    #0 [internal function]: Drupal\Core\StreamWrapper\StreamWrapperManager->__construct()
    #1 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1140): ReflectionClass->newInstanceArgs()
    #2 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(586): Symfony\Component\DependencyInjection\ContainerBuilder->createService()
    #3 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1258): Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
    #4 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1210): S
    ymfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #5 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1110): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #6 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(586): Symfony\Component\DependencyInjection\ContainerBuilder->createService()
    #7 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1258): Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
    #8 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1210): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #9 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1110): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #10 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(586): Symfony\Component\DependencyInjection\ContainerBuilder->createService()
    #11 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(531): Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
    #12 drupal-10.3.x/html/core/lib/Drupal/Core/Cache/CacheFactory.php(110): Symfony\Component\DependencyInjection\ContainerBuilder->get()
    #13 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1121): Drupal\Core\Cache\CacheFactory->get()
    #14 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(586): Symfony\Component\DependencyInjection\ContainerBuilder->createService()
    #15 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1258): Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
    #16 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1210): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #17 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(1110): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices()
    #18 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(586): Symfony\Component\DependencyInjection\ContainerBuilder->createService()
    #19 drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(531): Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
    #20 drupal-10.3.x/html/modules/contrib/zoomapi/src/ZoomapiServiceProvider.php(17): Symfony\Component\DependencyInjection\ContainerBuilder->get()
    #21 drupal-10.3.x/html/core/lib/Drupal/Core/DependencyInjection/Compiler/ModifyServiceDefinitionsPass.php(30): Drupal\zoomapi\ZoomapiServiceProvider->alter()
    #22 drupal-10.3.x/vendor/symfony/dependency-injection/Compiler/Compiler.php(80): Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass->process()
    #23 /var/aegir/platforms/d
    rupal/10/distro/1-dev/custom/dev4-cci-social-13.x-drupal-10.3.x/vendor/symfony/dependency-injection/ContainerBuilder.php(767): Symfony\Component\DependencyInjection\Compiler\Compiler->compile()
    #24 drupal-10.3.x/html/core/lib/Drupal/Core/DrupalKernel.php(1447): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
    #25 drupal-10.3.x/html/core/lib/Drupal/Core/DrupalKernel.php(971): Drupal\Core\DrupalKernel->compileContainer()
    #26 drupal-10.3.x/html/core/lib/Drupal/Core/DrupalKernel.php(515): Drupal\Core\DrupalKernel->initializeContainer()
    #27 drupal-10.3.x/html/core/includes/utility.inc(34): Drupal\Core\DrupalKernel->boot()
    #28 /usr/local/share/drush/commands/core/cache.drush.inc(302): drupal_rebuild()
    #29 /usr/local/share/drush/includes/command.inc(422): drush_cache_rebuild()
    #30 /usr/local/share/drush/includes/command.inc(231): _drush_invoke_hooks()
    #31 /usr/local/share/drush/includes/command.inc(199): drush_command()
    #32 /usr/local/share/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch()
    #33 /usr/local/share/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
    #34 /usr/local/share/drush/drush.php(12): drush_main()
    #35 {main}

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    @socialnicheguru -- Did you already have the module installed when you applied the patch? If so, you may need to clear cache since the services were getting updated.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gokul.jayan

    Applying the MR patch helps eliminate the warning message.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

    I have not set anything up yet, no credentials, etc.
    I uninstall it on Drupal 10.4, php8.2, zoomapi 3.x.
    I apply the patch.
    i install zoomapi.
    I get the above error in #12
    I cannot use drush to clear cache

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States AaronBauman Philadelphia

    MR4 fixes the issue for me.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany andrerb

    With the changes in the file ZoomapiServiceProvider.php I get the error: โ€˜There is currently no session available.โ€™ when executing โ€˜drush updbโ€™ in the CLI. When I try to execute DB Update via the UI I get the following error:

    > The website encountered an unexpected error. Try again later.
    > TypeError: Drupal\Core\Session\SessionConfiguration::getOptions(): Argument #1 ($request) must be of type Symfony\Component\HttpFoundation\Request, null given, called in /var/www/html/docroot/core/lib/Drupal/Core/Session/SessionManager.php on line 120 in Drupal\Core\Session\SessionConfiguration->getOptions() (line 48 of core/lib/Drupal/Core/Session/SessionConfiguration.php).
    > Drupal\Core\Session\SessionConfiguration->getOptions() (Line: 120)
    > Drupal\Core\Session\SessionManager->start() (Line: 59)
    > Symfony\Component\HttpFoundation\Session\Session->start() (Line: 1000)
    > Drupal\Core\DrupalKernel->initializeContainer() (Line: 42)
    > Drupal\Core\Update\UpdateKernel->initializeContainer() (Line: 1218)
    > Drupal\Core\DrupalKernel->rebuildContainer() (Line: 470)
    > drupal_flush_all_caches() (Line: 362)
    > Drupal\system\Controller\DbUpdateController->selection() (Line: 173)
    > Drupal\system\Controller\DbUpdateController->handle()
    > call_user_func_array() (Line: 115)
    > Drupal\Core\Update\UpdateKernel->handleRaw() (Line: 76)
    > Drupal\Core\Update\UpdateKernel->handle() (Line: 28)

    I also get this error after the update hook zoomapi_update_9002() has run successfully and I run drush updb again.

    If I completely revert the changes in the ZoomapiServiceProvider.php, the DB update runs again without errors.

    Uninstalling and installing the module did not help. The API Tools module is activated.

    I'm still trying to figure out the problem.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    Hi @andrerb sorry you are having issues.

    So, are you trying to upgrade from 2.x to 3.x? I just want to make sure I'm clear on your issue.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany andrerb

    @joelsteidl thanks for the quick reply.
    We have been on the latest Alpha 3 since September'23 and just updated to the current stable version and as I wrote reverting the changes in ZoomapiServiceProvider.php fixes the problem. No other changes made.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    I do think there is something to look into with the "There is currently no session available." error when doing database updates.

    I was able to successfully do the following though:

    Fresh install of Drupal 10.4.3
    composer require 'drupal/zoomapi:3.0@alpha'
    Installed Zoom API 3.0@alpha3
    composer require 'drupal/zoomapi:^3.0'
    ddev drush updb
    No pending updates.
    
    Fresh install of Drupal 10.4.3
    composer require 'drupal/zoomapi:^2.1'
    Installed Zoom API 2.1
    composer require 'drupal/zoomapi:^3.0'
    ddev drush updb (had to run twice...failure the first time)
    ddev drush cr (for the new configuration page to appear)
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joelsteidl

    FYI, I created http://drupal.org/project/zoomapi/issues/3510991 for the db update issue

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany andrerb

    Thank you

Production build 0.71.5 2024