Closed Fedik closed 8 years ago
That's a bug in Joomla! and I believe @mbabker has already told you. The updateObject's signature says that the method returns a boolean. See https://github.com/joomla/joomla-cms/blob/5c0f405d5f4f9a26e275bec375cefe641cb209b5/libraries/joomla/database/driver.php#L1838-L1838
Please fix Joomla!. FYI the problem is that JDatabaseDriverPdo::execute() returns an object (instead of boolean) when a non-SELECT statement is executed. As a result you should overload JDatabaseDriverPdo::updateObject (and insertObject) with something like return (parent::updateObject(.....) !== false)
. I will NOT add if-blocks on top of if-blocks just because Joomla! won't bother fixing their broken code. If they think their code is correct they have to change the signature, but this is a backwards compatibility break which calls for a major version change (since they follow semantic versioning). So, no, the bug is in Joomla! itself, I will have to insist.
Since the bug lies in Joomla!, not in FOF, I am closing this issue.
It's a Joomla bug because updateObject()
blindly returns the result of $db->execute();
without additional logic checks which breaks the documented boolean return (execute()
returns A database cursor resource on success, boolean false on failure.
).
Documented or not, fixing it is also borderline B/C break in cases where an implementor uses the undocumented return value (which with the current behavior is acceptable).
Truthfully, insertObject and updateObject have a lot of inconsistencies. Frankly, I just don't care enough to fix them right now and after the week I had last week I'm even less enthused to do anything with Joomla.
FOFTable::store
always returnfalse
on _db->updateObject, when Joomla database driver is MySql PDO The reason that the PDO result is PDO Object not a boolean, but the code expect boolean in some reason.originally reported https://github.com/joomla/joomla-cms/issues/8525