Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
3f31e7d1
Commit
3f31e7d1
authored
4 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused class; closes #1421
parent
34087fdf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/Error/Assertion.php
+0
-85
0 additions, 85 deletions
lib/SimpleSAML/Error/Assertion.php
www/_include.php
+1
-1
1 addition, 1 deletion
www/_include.php
with
1 addition
and
86 deletions
lib/SimpleSAML/Error/Assertion.php
deleted
100644 → 0
+
0
−
85
View file @
34087fdf
<?php
declare
(
strict_types
=
1
);
namespace
SimpleSAML\Error
;
use
SimpleSAML\Assert\Assert
;
/**
* Class for creating exceptions from assertion failures.
*
* @package SimpleSAMLphp
*/
class
Assertion
extends
Exception
{
/**
* The assertion which failed, or null if only an expression was passed to the
* assert-function.
*/
private
$assertion
;
/**
* Constructor for the assertion exception.
*
* Should only be called from the onAssertion handler.
*
* @param string|null $assertion The assertion which failed, or null if the assert-function was
* given an expression.
*/
public
function
__construct
(
string
$assertion
=
null
)
{
$msg
=
'Assertion failed: '
.
var_export
(
$assertion
,
true
);
parent
::
__construct
(
$msg
);
$this
->
assertion
=
$assertion
;
}
/**
* Retrieve the assertion which failed.
*
* @return string|null The assertion which failed, or null if the assert-function was called with an expression.
*/
public
function
getAssertion
():
?string
{
return
$this
->
assertion
;
}
/**
* Install this assertion handler.
*
* This function will register this assertion handler. If will not enable assertions if they are
* disabled.
*/
public
static
function
installHandler
():
void
{
assert_options
(
ASSERT_WARNING
,
0
);
assert_options
(
ASSERT_QUIET_EVAL
,
0
);
assert_options
(
ASSERT_CALLBACK
,
[
Assertion
::
class
,
'onAssertion'
]);
}
/**
* Handle assertion.
*
* This function handles an assertion.
*
* @param string $file The file assert was called from.
* @param int $line The line assert was called from.
* @param mixed $message The expression which was passed to the assert-function.
*/
public
static
function
onAssertion
(
string
$file
,
int
$line
,
$message
):
void
{
if
(
!
empty
(
$message
))
{
$exception
=
new
self
(
$message
);
}
else
{
$exception
=
new
self
();
}
$exception
->
logError
();
}
}
This diff is collapsed.
Click to expand it.
www/_include.php
+
1
−
1
View file @
3f31e7d1
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
require_once
(
dirname
(
dirname
(
__FILE__
))
.
'/lib/_autoload.php'
);
require_once
(
dirname
(
dirname
(
__FILE__
))
.
'/lib/_autoload.php'
);
// enable assertion handler for all pages
// enable assertion handler for all pages
\SimpleSAML\Error\Assertion
::
installHandler
();
//
\SimpleSAML\Error\Assertion::installHandler();
// show error page on unhandled exceptions
// show error page on unhandled exceptions
function
SimpleSAML_exception_handler
(
$exception
)
function
SimpleSAML_exception_handler
(
$exception
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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