public static function fatalError($message) { (new Log(ERROR_LOG))->setFatal(true)->logMessage($message . "\n" . stackTrace()); // Show a Friendly Error Page $view = new HTMLView(true); $view->includeTemplate('error.fatal', ['app_name' => AppConfig::getValue('app_name')]); $view->render(true); exit; // terminate script (regardless of location) }
/** * Tests that the stackTrace() method is a shortcut for Debugger::trace() * * @return void */ public function testStackTrace() { ob_start(); list(, $expected) = array(stackTrace(), Debugger::trace()); $result = ob_get_clean(); $this->assertEquals($expected, $result); $opts = array('args' => true); ob_start(); list(, $expected) = array(stackTrace($opts), Debugger::trace($opts)); $result = ob_get_clean(); $this->assertEquals($expected, $result); }
/** * Tests that the stackTrace() method is a shortcut for Debugger::trace() * * @return void */ public function testStackTrace() { ob_start(); list($r, $expected) = [stackTrace(), \Cake\Error\Debugger::trace()]; $result = ob_get_clean(); $this->assertEquals($expected, $result); $opts = ['args' => true]; ob_start(); list($r, $expected) = [stackTrace($opts), \Cake\Error\Debugger::trace($opts)]; $result = ob_get_clean(); $this->assertEquals($expected, $result); }
function dbInc($table, $data, $where) { $sql_string = ""; foreach ($data as $dataid => &$value) { if (!empty($sql_string)) { $sql_string .= ', '; } $id = dbEscapeString($dataid); $sql_string .= "{$id}={$id}" . ($value > 0 ? '+' : '-') . dbEscapeString($value); } $sql = "UPDATE {$table} SET {$sql_string}" . ($where != '' ? " WHERE {$where}" : ''); global $dbLink; if (!$dbLink) { _dbDelayedConnect(); } $result = mysql_query($sql) or die('lib/db.php->dbUpdate: ' . mysql_error() . stackTrace()); return $result; }