No Code Attached Yet J3 Issue
avatar dannysmc95
dannysmc95
20 Jun 2018

Steps to reproduce the issue

  • Create a component
  • In the component make a query that does the: $db->updateObject(); method,
  • View the output, for us it comes back as:

Expected result

Boolean: true/false

Actual result

object(PDOStatement)#340 (1) {
 ["queryString"]=>
 string(56) "UPDATE `am_lots` SET `hammer_price`='0' WHERE `id` = '0'"
}

System information (as much as possible)

Database Type: MySQL (PDO)
Error reporting: Maximum
Debugging: false
Joomla Version: 3.8.6

Additional comments

We have literally installed the Joomla instance and started developing, it's been about 2 months, and then we noticed this issue. This doesn't happen when using MySQLi as the driver.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar dannysmc95 dannysmc95 - open - 20 Jun 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Jun 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Jun 2018
Priority Urgent Medium
avatar mbabker
mbabker - comment - 20 Jun 2018

Can't be fixed without a B/C break. Don't worry about the return value here, at this point if something is using the return of JDatabaseDriver::execute() that'll indicate a successful query and a failed query will have an exception thrown.

avatar dannysmc95 dannysmc95 - change - 20 Jun 2018
The description was changed
avatar dannysmc95 dannysmc95 - edited - 20 Jun 2018
avatar dannysmc95
dannysmc95 - comment - 20 Jun 2018

Hi @mbabker, thanks for that but that isn't the case, if we create a query that WILL fail, then it still returns the PDOStatement.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20813.

avatar dannysmc95
dannysmc95 - comment - 20 Jun 2018

Therefore doing something like:

$status = $db->updateObject():
if ($status) {}

This will always succeed, even if it fails.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20813.

avatar mbabker
mbabker - comment - 20 Jun 2018

Then that means PDOStatement::execute() is returning a true-ish value which our API does not consider a query failure (a query failure being an actual database error, not a "no results" type thing). If there's a case where it is returning something true-ish that should be evaluated as a false or error case, this check needs updated to account for it.

avatar dannysmc95
dannysmc95 - comment - 20 Jun 2018

@mbabker then I would suggest that check needs to be looked at, because only if there is an error within the jDatabase class will it throw an error, otherwise it will execute a update query which fails, and it does not catch it or return anything.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20813.

avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Jun 2018
Status New Discussion
avatar brianteeman brianteeman - change - 2 Aug 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 2 Aug 2018
avatar jwaisner jwaisner - change - 18 Mar 2020
Status Discussion Confirmed
Build master staging
avatar roland-d roland-d - change - 15 Oct 2022
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2022-10-15 19:08:23
Closed_By roland-d
Labels Added: No Code Attached Yet
Removed: ?
avatar roland-d roland-d - close - 15 Oct 2022
avatar roland-d
roland-d - comment - 15 Oct 2022

@dannysmc95 This was just brought to my attention, so I figured I give it a test on Joomla 4, and I see your expected behavior now. A successful query will return a boolean true, a failed query will throw an exception.

If you are not seeing this behavior on Joomla 4 please re-open the issue so we can investigate further.

Add a Comment

Login with GitHub to post a comment