diff --git a/core/metamodel.class.php b/core/metamodel.class.php index bfb629dc3..895f57092 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -6383,12 +6383,14 @@ abstract class MetaModel } catch(Exception $e) { - // We need to pop the pushed archived mode before the exception is thrown, otherwise the application stays in ArchiveMode true which has caused hazardious behavior! - // Note: When switching to PHP 5.6, we can use a finally block instead of duplicating this line. - utils::PopArchiveMode(); + // In the finally block we will pop the pushed archived mode + // otherwise the application stays in ArchiveMode true which has caused hazardious behavior! throw $e; } - utils::PopArchiveMode(); + finally + { + utils::PopArchiveMode(); + } if (empty($aRow)) { diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index acdd558f0..469d6a0b6 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -549,26 +549,7 @@ class SetupUtils */ static function GetTmpDir() { - // try to figure out what is the temporary directory - // prior to PHP 5.2.1 the function sys_get_temp_dir - // did not exist - if ( !function_exists('sys_get_temp_dir')) - { - if( $temp=getenv('TMP') ) return realpath($temp); - if( $temp=getenv('TEMP') ) return realpath($temp); - if( $temp=getenv('TMPDIR') ) return realpath($temp); - $temp=tempnam(__FILE__,''); - if (file_exists($temp)) - { - unlink($temp); - return realpath(dirname($temp)); - } - return null; - } - else - { - return realpath(sys_get_temp_dir()); - } + return realpath(sys_get_temp_dir()); } /**