N°4558 Fix possible PHP notice in \CMDBSource::StartTransaction

This commit is contained in:
Pierre Goiffon
2021-12-31 16:34:19 +01:00
parent 6bf25f90bc
commit 25e560fdaa
2 changed files with 5 additions and 4 deletions

View File

@@ -790,14 +790,14 @@ class CMDBSource
private static function StartTransaction()
{
$aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3);
$sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()';
$bHasExistingTransactions = self::IsInsideTransaction();
if (!$bHasExistingTransactions)
{
IssueLog::Trace("START TRANSACTION $sCaller", 'cmdbsource');
IssueLog::Trace("START TRANSACTION was sent to the DB", LogChannels::CMDBSOURCE, ['stacktrace' => $aStackTrace]);
self::DBQuery('START TRANSACTION');
} else {
IssueLog::Trace("Ignore nested (".self::$m_iTransactionLevel.") START TRANSACTION $sCaller", 'cmdbsource');
IssueLog::Trace("START TRANSACTION ignored as a transaction is already opened", LogChannels::CMDBSOURCE, ['stacktrace' => $aStackTrace]);
}
self::AddTransactionLevel();