From 2d6d1132c7deb74fd29042d1fe82bb6c732d75c8 Mon Sep 17 00:00:00 2001 From: acognet Date: Wed, 7 Oct 2020 13:26:38 +0200 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B03262=20-=20Avoid=20PHP=20notices=20o?= =?UTF-8?q?n=20DBObject=20core=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobject.class.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/core/dbobject.class.php b/core/dbobject.class.php index aba3b5a25..a693d26f8 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -3741,16 +3741,14 @@ abstract class DBObject implements iDisplay // save current object values in case of an action failure (in memory rollback) $aBackupValues = array(); - foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) - { - $value = $this->m_aCurrValues[$sAttCode]; - if (is_object($value)) - { - $aBackupValues[$sAttCode] = clone $value; - } - else - { - $aBackupValues[$sAttCode] = $value; + foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { + if (isset($this->m_aCurrValues[$sAttCode])) { + $value = $this->m_aCurrValues[$sAttCode]; + if (is_object($value)) { + $aBackupValues[$sAttCode] = clone $value; + } else { + $aBackupValues[$sAttCode] = $value; + } } } From 06acac97ba7f32f7bb71c636dc945561009b665c Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 7 Oct 2020 16:19:54 +0200 Subject: [PATCH 2/2] :white_check_mark: Fix tests * update datamodel XML version * Remove \Combodo\iTop\Test\UnitTest\Core\OQLTest::testTypeErrorQueryParser --- application/datamodel.application.xml | 2 +- core/datamodel.core.xml | 8 +++++--- test/core/OQLTest.php | 25 ------------------------- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/application/datamodel.application.xml b/application/datamodel.application.xml index f2910b821..b74791dea 100644 --- a/application/datamodel.application.xml +++ b/application/datamodel.application.xml @@ -1,5 +1,5 @@ - + pages/UI.php diff --git a/core/datamodel.core.xml b/core/datamodel.core.xml index 624854e32..3606d3299 100644 --- a/core/datamodel.core.xml +++ b/core/datamodel.core.xml @@ -1,11 +1,13 @@ - + REST Services User - Only users having this profile are allowed to use the REST Web Services (unless 'secure_rest_services' is set to false in the configuration file). - + Only users having this profile are allowed to use the REST Web Services (unless 'secure_rest_services' is set to false + in the configuration file). + + diff --git a/test/core/OQLTest.php b/test/core/OQLTest.php index 32882a0ef..d7b3939a3 100644 --- a/test/core/OQLTest.php +++ b/test/core/OQLTest.php @@ -212,31 +212,6 @@ class OQLTest extends ItopDataTestCase ); } - /** - * @dataProvider TypeErrorQueryProvider - * @depends testOQLSetup - * - * @param $sQuery - * - * @expectedException \CoreException - * - * @throws \OQLException - */ - public function testTypeErrorQueryParser($sQuery) - { - $this->debug($sQuery); - $oOql = new OqlInterpreter($sQuery); - $oOql->ParseQuery(); - } - - public function TypeErrorQueryProvider() - { - return array( - array('SELECT A WHERE A.a MATCHES toto'), - ); - } - - /** * Needs actual datamodel * @depends testOQLSetup