Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
1eb838a8
Unverified
Commit
1eb838a8
authored
4 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(core) Show correct stack trace for new error classes
issue
#6071
parent
172f088f
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class_msg_dialog.inc
+16
-7
include/class_msg_dialog.inc
include/errors/class_SimplePluginCheckError.inc
+10
-1
include/errors/class_SimplePluginCheckError.inc
with
26 additions
and
8 deletions
+26
-8
include/class_msg_dialog.inc
+
16
−
7
View file @
1eb838a8
...
@@ -41,7 +41,7 @@ class msg_dialog
...
@@ -41,7 +41,7 @@ class msg_dialog
private
$s_Message
;
private
$s_Message
;
private
$i_Type
;
private
$i_Type
;
private
$i_ID
;
private
$i_ID
;
private
$a_Trace
=
[]
;
private
$a_Trace
;
/*!
/*!
* \brief Message dialog constructor
* \brief Message dialog constructor
...
@@ -50,9 +50,11 @@ class msg_dialog
...
@@ -50,9 +50,11 @@ class msg_dialog
*
*
* \param string $message The message of the message dialog
* \param string $message The message of the message dialog
*
*
* \param string $type The type of the message dialog, by default = INFO_DIALOG
* \param int $type The type of the message dialog, by default = INFO_DIALOG
*
* \param array $trace The trace from where the message was built
*/
*/
public
function
__construct
(
$title
,
$message
,
$type
=
INFO_DIALOG
)
public
function
__construct
(
string
$title
,
string
$message
,
int
$type
=
INFO_DIALOG
,
array
$trace
=
[]
)
{
{
if
(
!
in_array
(
$type
,
[
INFO_DIALOG
,
WARNING_DIALOG
,
ERROR_DIALOG
,
CONFIRM_DIALOG
,
FATAL_ERROR_DIALOG
]))
{
if
(
!
in_array
(
$type
,
[
INFO_DIALOG
,
WARNING_DIALOG
,
ERROR_DIALOG
,
CONFIRM_DIALOG
,
FATAL_ERROR_DIALOG
]))
{
trigger_error
(
'Invalid msg_dialog type.'
);
trigger_error
(
'Invalid msg_dialog type.'
);
...
@@ -63,6 +65,7 @@ class msg_dialog
...
@@ -63,6 +65,7 @@ class msg_dialog
$this
->
s_Title
=
$title
;
$this
->
s_Title
=
$title
;
$this
->
s_Message
=
$message
;
$this
->
s_Message
=
$message
;
$this
->
i_Type
=
$type
;
$this
->
i_Type
=
$type
;
$this
->
a_Trace
=
$trace
;
}
}
protected
function
show
()
protected
function
show
()
...
@@ -93,7 +96,11 @@ class msg_dialog
...
@@ -93,7 +96,11 @@ class msg_dialog
/* Append trace information, only if error messages are enabled */
/* Append trace information, only if error messages are enabled */
if
(
isset
(
$config
)
&&
is_object
(
$config
)
&&
if
(
isset
(
$config
)
&&
is_object
(
$config
)
&&
$config
->
get_cfg_value
(
'displayerrors'
)
==
'TRUE'
)
{
$config
->
get_cfg_value
(
'displayerrors'
)
==
'TRUE'
)
{
$this
->
a_Trace
=
debug_backtrace
();
if
(
empty
(
$this
->
a_Trace
))
{
$this
->
a_Trace
=
debug_backtrace
();
}
}
else
{
$this
->
a_Trace
=
[];
}
}
if
(
$this
->
i_Type
==
FATAL_ERROR_DIALOG
)
{
if
(
$this
->
i_Type
==
FATAL_ERROR_DIALOG
)
{
restore_error_handler
();
restore_error_handler
();
...
@@ -117,11 +124,13 @@ class msg_dialog
...
@@ -117,11 +124,13 @@ class msg_dialog
*
*
* \param string $message The message of the message dialog
* \param string $message The message of the message dialog
*
*
* \param string $type The type of the message dialog, by default = INFO_DIALOG
* \param int $type The type of the message dialog, by default = INFO_DIALOG
*
* \param array $trace The trace from where the message was built
*/
*/
public
static
function
display
(
$title
,
$message
,
$type
=
INFO_DIALOG
)
public
static
function
display
(
string
$title
,
string
$message
,
int
$type
=
INFO_DIALOG
,
array
$trace
=
[]
)
{
{
$dialog
=
new
msg_dialog
(
$title
,
$message
,
$type
);
$dialog
=
new
msg_dialog
(
$title
,
$message
,
$type
,
$trace
);
$dialog
->
show
();
$dialog
->
show
();
}
}
...
...
This diff is collapsed.
Click to expand it.
include/errors/class_SimplePluginCheckError.inc
+
10
−
1
View file @
1eb838a8
...
@@ -71,7 +71,16 @@ class SimplePluginCheckError extends FusionDirectoryError
...
@@ -71,7 +71,16 @@ class SimplePluginCheckError extends FusionDirectoryError
$html
.
=
'<br/><br/><i>'
.
sprintf
(
_
(
'Example: %s'
),
htmlescape
(
$example
))
.
'</i> '
;
$html
.
=
'<br/><br/><i>'
.
sprintf
(
_
(
'Example: %s'
),
htmlescape
(
$example
))
.
'</i> '
;
}
}
$trace
=
$this
->
getTrace
();
return
[
_
(
'Error'
),
$html
,
ERROR_DIALOG
];
array_unshift
(
$trace
,
[
'file'
=>
$this
->
getFile
(),
'line'
=>
$this
->
getLine
(),
]
);
return
[
_
(
'Error'
),
$html
,
ERROR_DIALOG
,
$trace
];
}
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets