php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81010 PDO boolean casting not working
Submitted: 2021-05-04 08:11 UTC Modified: 2021-05-04 10:18 UTC
From: sebastian dot woellmann at th-deg dot de Assigned: cmb (profile)
Status: Duplicate Package: PDO PgSQL
PHP Version: 7.4.18 OS: Macos 11.3.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sebastian dot woellmann at th-deg dot de
New email:
PHP Version: OS:

 

 [2021-05-04 08:11 UTC] sebastian dot woellmann at th-deg dot de
Description:
------------
After upgrading from 7.4.16 to 7.4.18 boolean casting in sql statements doesn' work any more. The error appears when using laravel/passport, but i can replicate it with own code.
I tried running it with version 8.0.5, doesn't work either.
With version 7.3.28 it works as intended.
The problem appeared this morning after updating MacOS to version 11.3.1 and then updating php via homebrew to version 7.4.18.

Error: 
SQLSTATE[42804]: Datatype mismatch: 7 ERROR:  column "personal_access_client" is of type boolean but expression is of type integer
LINE 1: ...pdated_at", "created_at") values ($1, $2, $3, $4, $5, $6, $7...
                                                             ^
HINT:  You will need to rewrite or cast the expression. (SQL: insert into "oauth_clients" ("user_id", "name", "secret", "redirect", "personal_access_client", "password_client", "revoked", "updated_at", "created_at") values (?, EnerPlanET Personal Access Client, MAq9IgpCf4c2X7kLIj9GuhOLg191fnsXtXitL7VO, http://localhost, 1, 0, 0, 2021-05-04 06:56:49, 2021-05-04 06:56:49) returning "id")

For anyone running into a similar problem: the only way i was able to fix the issue was downgrading to php 7.3.28. I guess downgrading to 7.4.16 would also work, but homebrew doesn't support that

Test script:
---------------
The error occurs when executing "php artisan passport:install"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-04 10:18 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-05-04 10:18 UTC] cmb@php.net
This is a duplicate of bug #81002, which will be fixed in
PHP 7.4.19 and 8.0.6.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 22:01:33 2024 UTC