Merge pull request #19311 from atm-john/12.0_fix_missing_return_status_for_getrow

FIX : missing return status
This commit is contained in:
Laurent Destailleur 2021-11-05 12:42:54 +01:00 committed by GitHub
commit 23749b57ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,16 +308,20 @@ abstract class DoliDB implements Database
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
* Dont add LIMIT to your query, it will be added by this method
* @param string $sql the sql query string
* @return bool| object
* @return bool|int|object false on failure, 0 on empty, object on success
*/
public function getRow($sql)
{
$sql .= ' LIMIT 1;';
$sql .= ' LIMIT 1';
$res = $this->query($sql);
if ($res)
{
return $this->fetch_object($res);
if ($res) {
$obj = $this->fetch_object($res);
if ($obj) {
return $obj;
} else {
return 0;
}
}
return false;