Deprecated function: PDO::quote(): Passing null to parameter #2 ($type) of type int is deprecated in Drupal\Core\Database\Connection->quote()

Created on 30 August 2023, about 1 year ago

Problem/Motivation

Website encounter error while heavy lifting join queries requested via reader instance due to quote param set by default NULL.

Deprecated function: PDO::quote(): Passing null to parameter #2 ($type) of type int is deprecated in Drupal\Core\Database\Connection->quote() (line 2015 of /var/www/html/core/lib/Drupal/Core/Database/Connection.php)
#0 /var/www/html/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/html/core/lib/Drupal/Core/Database/Connection.php(2015): PDO->quote()
#3 /var/www/html/core/lib/Drupal/Core/Database/Driver/autoslave/Connection.php(208): Drupal\Core\Database\Connection->quote()
#4 /var/www/html/core/modules/views_ui/src/ViewUI.php(642): Drupal\Core\Database\Driver\autoslave\Connection->quote()
#5 /var/www/html/core/modules/views_ui/src/ViewPreviewForm.php(62): Drupal\views_ui\ViewUI->renderPreview()
#6 /var/www/html/core/lib/Drupal/Core/Entity/EntityForm.php(106): Drupal\views_ui\ViewPreviewForm->form()
#7 /var/www/html/core/modules/views_ui/src/ViewFormBase.php(41): Drupal\Core\Entity\EntityForm->buildForm()
#8 [internal function]: Drupal\views_ui\ViewFormBase->buildForm()
#9 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#10 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm()
#11 /var/www/html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#12 /var/www/html/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#13 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#14 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#15 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#17 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#18 /var/www/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#20 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#21 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#22 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#23 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#24 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#25 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#26 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle()
#27 {main}

Proposed resolution

Connection->quote() argument shouldn't be NULL as per Core DB Connection.php here

  public function quote($string, $parameter_type = \PDO::PARAM_STR) {
    return $this->connection->quote($string, $parameter_type);
  }

Code Snippet from Autoslave Connection.php here

  public function quote($string, $parameter_type = \PDO::PARAM_STR) { return $this->getMasterConnection()->quote($string, $parameter_type); }
🐛 Bug report
Status

Active

Component

Code

Created by

🇮🇳India muthuraman-s

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

Comments & Activities

Production build 0.71.5 2024