User tests: Successful: Unsuccessful:
Pull Request for Issue: SQL error on PDO on #__session
table
changed ParameterType
from BOOLEAN to INTEGER
login/logout with a PDO driver
no errors on driver log's
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
To be fair, Joomla doesn't use boolean fields at all. Should it?
A lot of our integer fields are actually booleans. I’m not sure if there’s actually a reason for it or not though
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
Labels |
Added:
?
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-03-15 11:35:46 |
Closed_By | ⇒ | wilsonge |
Thanks
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.
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?♂️