Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory
Commits
d3cdf82d
Commit
d3cdf82d
authored
Mar 30, 2017
by
Côme Chilliet
Browse files
Fixes #5453 Added an fopen which returns the errors
parent
9ccb2bef
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/functions.inc
View file @
d3cdf82d
...
...
@@ -2706,4 +2706,23 @@ function mail_utf8($to, $from_user, $from_email, $subject, $message, $type = 'pl
return
mail
(
$to
,
$subject
,
$message
,
$headers
,
$additional_parameters
);
}
/* Calls fopen, gives errors as an array if any, file handle if successful */
function
fopenWithErrorHandling
()
{
$args
=
func_get_args
();
$errors
=
array
();
set_error_handler
(
function
(
$errno
,
$errstr
,
$errfile
,
$errline
,
$errcontext
)
use
(
&
$errors
)
{
$errors
[]
=
$errstr
;
}
);
$fh
=
@
call_user_func_array
(
'fopen'
,
$args
);
restore_error_handler
();
if
(
$fh
!==
FALSE
)
{
return
$fh
;
}
return
$errors
;
}
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment