Argument #3 ($previous) must be of type ?Throwable ON insert.php

Created on 18 February 2022, over 2 years ago
Updated 13 February 2023, over 1 year ago

Problem/Motivation

I am finding in the reports the following message:

TypeError: Exception::__construct(): Argument #3 ($previous) must be of type ?Throwable, string given in Exception->__construct() (line 103 of /var/www/drupal/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php)

In the line 103 of Insert.php we see:

throw new DatabaseExceptionWrapper($message, 0, $e->getCode());

"DatabaseExceptionWrapper" extends "\RuntimeException" that expect as third parameter a "Throwable". Here "$e" is a "PDOException", and getCode() return a string.

Steps to reproduce

I can't tell when it happens exactly because it hides the real DB error.

Proposed resolution

Use "$e" as third parameter instead of "$e->getCode()"

🐛 Bug report
Status

Closed: outdated

Version

9.2

Component
PostgreSQL driver 

Last updated 10 days ago

No maintainer
Created by

🇪🇸Spain Manuel Ortiz

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024