Skip to content

Commit bed821b

Browse files
committed
Throw library-exception instead of PHP-native
1 parent f3c2f16 commit bed821b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Assert/XPathFilterTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace SimpleSAML\XML\Assert;
66

7-
use Exception;
87
use SimpleSAML\Assert\Assert as BaseAssert;
98
use SimpleSAML\Assert\AssertionFailedException;
109
use SimpleSAML\XML\Constants as C;
10+
use SimpleSAML\XML\Exception\RuntimeException;
1111

1212
use function in_array;
1313
use function preg_match_all;
@@ -129,7 +129,7 @@ public static function validAllowedXPathFilter(
129129
);
130130

131131
if ($strippedValue === null) {
132-
throw new Exception("Error in preg_replace.");
132+
throw new RuntimeException("Error in preg_replace.");
133133
}
134134

135135
self::validAllowedXpathFunctions($strippedValue, $allowed_functions);
@@ -157,7 +157,7 @@ public static function validAllowedXPathFunctions(
157157
$matches = [];
158158
$res = preg_match_all(self::$regex_xpfilter_functions, $value, $matches);
159159
if ($res === false) {
160-
throw new Exception("Error in preg_match_all.");
160+
throw new RuntimeException("Error in preg_match_all.");
161161
}
162162

163163
// Check that all the function names we found are in the list of allowed function names
@@ -192,7 +192,7 @@ public static function validAllowedXPathAxes(
192192
$matches = [];
193193
$res = preg_match_all(self::$regex_xpfilter_axes, $value, $matches);
194194
if ($res === false) {
195-
throw new Exception("Error in preg_match_all.");
195+
throw new RuntimeException("Error in preg_match_all.");
196196
}
197197

198198
// Check that all the axes names we found are in the list of allowed axes names

0 commit comments

Comments
 (0)