private function write_log($user_id, $exception) { $file = $exception->getFile(); $file = str_replace('\\', '\\\\', $file); $trace_as_string = $exception->getTraceAsString(); $trace_as_string = str_replace('\\', '\\\\', $trace_as_string); $trace_as_string = str_replace('\'', '\\"', $trace_as_string); $system_log = new SystemLog(null); $system_log->create($user_id, 2, 1, $exception->getMessage(), $exception->getCode(), $file, $exception->getLine(), null); $system_log->set_stack_trace($trace_as_string); }