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
7974a118
Commit
7974a118
authored
3 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
print_r() with second param true is guaranteed to return a string
parent
e9f886ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Utils/Attributes.php
+10
-5
10 additions, 5 deletions
lib/SimpleSAML/Utils/Attributes.php
with
10 additions
and
5 deletions
lib/SimpleSAML/Utils/Attributes.php
+
10
−
5
View file @
7974a118
...
...
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace
SimpleSAML\Utils
;
use
InvalidArgumentException
;
use
SimpleSAML\Error
;
/**
...
...
@@ -35,14 +36,14 @@ class Attributes
$attribute
=
$attributes
[
$expected
];
if
(
!
is_array
(
$attribute
))
{
throw
new
\
InvalidArgumentException
(
'The attributes array is not normalized, values should be arrays.'
);
throw
new
InvalidArgumentException
(
'The attributes array is not normalized, values should be arrays.'
);
}
if
(
count
(
$attribute
)
===
0
)
{
throw
new
Error\Exception
(
"Empty attribute '"
.
$expected
.
"'.'"
);
}
elseif
(
count
(
$attribute
)
>
1
)
{
if
(
$allow_multiple
===
false
)
{
throw
new
\SimpleSAML\
Error\Exception
(
throw
new
Error\Exception
(
'More than one value found for the attribute, multiple values not allowed.'
);
}
...
...
@@ -71,7 +72,9 @@ class Attributes
$newAttrs
=
[];
foreach
(
$attributes
as
$name
=>
$values
)
{
if
(
!
is_string
(
$name
))
{
throw
new
\InvalidArgumentException
(
'Invalid attribute name: "'
.
print_r
(
$name
,
true
)
.
'".'
);
/** @var string $name */
$name
=
print_r
(
$name
,
true
);
throw
new
InvalidArgumentException
(
sprintf
(
'Invalid attribute name: "%s".'
,
$name
));
}
$arrayUtils
=
new
Arrays
();
...
...
@@ -79,8 +82,10 @@ class Attributes
foreach
(
$values
as
$value
)
{
if
(
!
is_string
(
$value
))
{
throw
new
\InvalidArgumentException
(
'Invalid attribute value for attribute '
.
$name
.
': "'
.
print_r
(
$value
,
true
)
.
'".'
/** @var string $value */
$value
=
print_r
(
$value
,
true
);
throw
new
InvalidArgumentException
(
sprintf
(
'Invalid attribute value for attribute %s: "%s".'
,
$name
,
$value
)
);
}
}
...
...
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