? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
10 Mar 2019

Pull Request for Issue: SQL error on PDO on #__session table

Summary of Changes

changed ParameterType from BOOLEAN to INTEGER

Testing Instructions

login/logout with a PDO driver

Expected result

no errors on driver log's

Actual result

postgres@joomla ERROR: invalid input syntax for integer: "t" 2019-03-10 11:15:38.322 CET [13179] postgres@joomla STATEMENT: UPDATE "pbf4_session" SET "guest" = $1 , "time" = $2 , "userid" = $3 , "username" = $4 , "client_id" = $5 WHERE "session_id" = $6

postgres@joomla ERROR: invalid input syntax for integer: "f" 2019-03-10 11:15:38.433 CET [13180] postgres@joomla STATEMENT: INSERT INTO "pbf4_session" ("session_id","guest","time","userid","username","client_id") VALUES ($1, $2, $3, $4, $5, $6)

cc: @mbabker

avatar alikon alikon - open - 10 Mar 2019
avatar alikon alikon - change - 10 Mar 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Mar 2019
Category Libraries
avatar mbabker
mbabker - comment - 10 Mar 2019

Of course a field that's supposed to be a boolean indicator, and has no relation to the database whatsoever, is processed AS A FREAKIN' INTEGER ?‍♂️

avatar SharkyKZ
SharkyKZ - comment - 12 Mar 2019

To be fair, Joomla doesn't use boolean fields at all. Should it?

avatar wilsonge
wilsonge - comment - 15 Mar 2019

A lot of our integer fields are actually booleans. I’m not sure if there’s actually a reason for it or not though

avatar alikon
alikon - comment - 15 Mar 2019

just to be clear this problem arise in PDO postgresql where it needs that the guest field is an Integer as it is declared on the table on PDO mysql this problem don't arise it works even with BOOLEAN or INTEGER

avatar wilsonge wilsonge - change - 15 Mar 2019
Labels Added: ?
avatar wilsonge wilsonge - change - 15 Mar 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-03-15 11:35:46
Closed_By wilsonge
avatar wilsonge wilsonge - close - 15 Mar 2019
avatar wilsonge wilsonge - merge - 15 Mar 2019
avatar wilsonge
wilsonge - comment - 15 Mar 2019

Thanks

avatar mbabker
mbabker - comment - 15 Mar 2019

My groan was because User::$guest is an integer. It's not a field that goes into the database, so there's no reason for that to be an integer as it's never going to be something that supports multiple states.

Unless the PDO PostgreSQL driver is being more strict about types than MySQL, integer 1/0 should evaluate over to boolean true/false when parameterizing values (and generally booleans are converted back to integer 1/0 when writing to the database), so I find it really weird as to why the parameter type here has to be changed to integer to match the database storage.

Add a Comment

Login with GitHub to post a comment