}
}
+/**
+ * Squelch error output to screen (only) for the given function.
+ *
+ * This provides an alternative to the @ error-suppression
+ * operator where errors will not be shown in the interface
+ * but will show up in the server log file (assuming the
+ * administrator has configured PHP logging).
+ *
+ * @since 1.4.12 and 1.5.2
+ *
+ * @param string $function The function to be executed
+ * @param array $args The arguments to be passed to the function
+ * (OPTIONAL; default no arguments)
+ * NOTE: The caller must take extra action if
+ * the function being called is supposed
+ * to use any of the parameters by
+ * reference. In the following example,
+ * $x is passed by reference and $y is
+ * passed by value to the "my_func"
+ * function.
+ * sq_call_function_suppress_errors('my_func', array(&$x, $y));
+ *
+ * @return mixed The return value, if any, of the function being
+ * executed will be returned.
+ *
+ */
+function sq_call_function_suppress_errors($function, $args=NULL) {
+ $display_errors = ini_get('display_errors');
+ ini_set('display_errors', '0');
+ $ret = call_user_func_array($function, $args);
+ ini_set('display_errors', $display_errors);
+ return $ret;
+}
+
/**
* Add a variable to the session.
* @param mixed $var the variable to register
function sqsession_start() {
global $base_uri;
- @session_start();
+ sq_call_function_suppress_errors('session_start');
+ // was: @session_start();
$session_id = session_id();
// session_starts sets the sessionid cookie buth without the httponly var
// m_u_f works better with restricted PHP installs (safe_mode, open_basedir),
// if that doesn't work, try a simple rename.
- if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$fullpath)) {
- if (!@rename($_FILES['attachfile']['tmp_name'], $fullpath)) {
+ if (!sq_call_function_suppress_errors('move_uploaded_file', array($_FILES['attachfile']['tmp_name'], $fullpath))) {
+ if (!sq_call_function_suppress_errors('rename', array($_FILES['attachfile']['tmp_name'], $fullpath))) {
return true;
}
}