Error: undefined function db_query

Created on 30 January 2023, almost 2 years ago
Updated 24 January 2024, 11 months ago

Error when attempting to open the Youtube Import menu after install. I believe db_query is deprecated in Drupal 9^ and should be \Drupal::database()->query() instead.

The website encountered an unexpected error. Please try again later.
Error: Call to undefined function db_query() in youtube_import_get() (line 29 of modules/contrib/youtube_import/youtube_import.module).
youtube_import_get() (Line: 35)
Drupal\youtube_import\Form\YoutubeImportForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('youtubeImport_admin_settings', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇸United States cdupree

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

Comments & Activities

  • Issue created by @cdupree
  • Assigned to Binoli Lalani
  • Issue was unassigned.
  • 🇮🇳India Binoli Lalani Gujarat

    Hello,

    This is fixed in 8.x-1.x branch.

    Thank you!

  • 🇺🇸United States joshuautley

    This error just popped up again with version 8.x-1.0 running on Drupal 9.5.5

    #0 [path omitted]/modules/contrib/youtube_import/src/Form/YoutubeImportForm.php(35): youtube_import_get()
    #1 [internal function]: Drupal\youtube_import\Form\YoutubeImportForm->buildForm()
    #2 [path omitted]/core/lib/Drupal/Core/Form/FormBuilder.php(534): call_user_func_array()
    #3 [path omitted]/core/lib/Drupal/Core/Form/FormBuilder.php(281): Drupal\Core\Form\FormBuilder->retrieveForm()
    #4 [path omitted]/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
    #5 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
    #6 [path omitted]/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #7 [path omitted]/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #8 [path omitted]/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
    #9 [path omitted]/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #10 [path omitted]/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #11 [path omitted]/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #12 [path omitted]/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #13 [path omitted]/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #14 [path omitted]/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #15 [path omitted]/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #16 [path omitted]/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #17 [path omitted]/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
    #18 [path omitted]/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #19 [path omitted]/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #20 [path omitted]/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
    #21 [path omitted]/index.php(19): Drupal\Core\DrupalKernel->handle()
    #22 {main}

  • Status changed to Needs review 11 months ago
  • 🇮🇳India abhishek_virasat

    @cdupree, I have fixed for version 8.x-1.0 running on Drupal 9.5.5. please kindly review the patch file

  • 🇺🇸United States joshuautley

    Excellent, I will test it out. Thank for the update.

Production build 0.71.5 2024