The error handler does now take care of not out-putting the error message to the...
authorRoland Häder <roland@mxchange.org>
Thu, 8 Nov 2012 20:19:08 +0000 (20:19 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 8 Nov 2012 20:19:08 +0000 (20:19 +0000)
inc/handler.php
inc/install-functions.php

index 84176c10b753b85329d780bc8d5c7da3e4f002c7..fe9149c99e20232393e4de3ed929e24c2e5761ec 100644 (file)
@@ -50,8 +50,17 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
                $errline
        );
 
-       // Output message to user and die
-       reportBug($errfile, $errline, $message);
+       // Is installation phase?
+       if (isInstallationPhase()) {
+               // Log error message
+               logDebugMessage($errfile, $errline, $message);
+       } else {
+               // Output message to user and die
+               reportBug($errfile, $errline, $message);
+       }
+
+       // Always return false
+       return FALSE;
 }
 
 // Init error handler
index 3dddbb89a4b9b38769d8554f93cff7b46fdd7c58..8ef45388ab1b3435d1ecbd357766ed548f39c324 100644 (file)
@@ -443,20 +443,11 @@ function isInstallerPostDatabaseConfigValid ($currentTab) {
                return FALSE;
        } // END - if
 
-       // Restore PHP's own error handler
-       if (!restore_error_handler()) {
-               // This is fatal
-               reportBug(__FUNCTION__, __LINE__, 'Could not unregister error handler.');
-       } // END - if
-
        // Try to connect to the database
        $linkResource = SQL_CONNECT(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__);
 
        // Is the link up
        if (!is_resource($linkResource)) {
-               // Restore own error handler again
-               set_error_handler('__errorHandler');
-
                // Cannot connect to database
                $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_CONNECT_ERROR--}';
                array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_login', 'mysql_password1', 'mysql_password2');
@@ -465,9 +456,6 @@ function isInstallerPostDatabaseConfigValid ($currentTab) {
 
        // Then attempt to select the database
        if (!SQL_SELECT_DB(postRequestElement('mysql_dbase'), __FUNCTION__, __LINE__)) {
-               // Restore own error handler again
-               set_error_handler('__errorHandler');
-
                // Could not find database
                $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_SELECT_FAILED--}';
                array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase');
@@ -478,25 +466,16 @@ function isInstallerPostDatabaseConfigValid ($currentTab) {
        setConfigEntry('__DB_NAME'    , postRequestElement('mysql_dbase'));
        setConfigEntry('_MYSQL_PREFIX', postRequestElement('mysql_prefix'));
 
-       // Restore own error handler again
-       set_error_handler('__errorHandler');
-
        // Get an array of all supported engines
        $engines = getArrayFromSupportedSqlEngines();
 
        // Is this an array?
        if (!is_array($engines)) {
-               // Restore own error handler again
-               set_error_handler('__errorHandler');
-
                // Something bad happened
                $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINES_SQL_ERROR--}';
                array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type');
                return FALSE;
        } elseif (count($engines) == 0) {
-               // Restore own error handler again
-               set_error_handler('__errorHandler');
-
                // No engine is active
                $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_NO_ENGINES_ACTIVE--}';
                array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type');
@@ -518,9 +497,6 @@ function isInstallerPostDatabaseConfigValid ($currentTab) {
 
        // So, is the engine found?
        if ($engineValid === FALSE) {
-               // Restore own error handler again
-               set_error_handler('__errorHandler');
-
                // Requested engine is not active
                $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINE_UNSUPPORTED--}';
                array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type');
@@ -579,9 +555,6 @@ function isInstallerPostDatabaseConfigValid ($currentTab) {
        // Disconnect here, we don't need idle database connections laying around
        SQL_CLOSE(__FUNCTION__, __LINE__);
 
-       // Restore own error handler again
-       set_error_handler('__errorHandler');
-
        // If the status is true, disconnect the database
        if ($isValid === FALSE) {
                // Still something bad happened (e.g. tables found)