Skip to content

Commit aba031c

Browse files
authored
library mentions missing values in config files
If config file is incomplete, `incompleteConfigurationException` exception is thrown. Now lib prints the value of missing param as well.
1 parent 283a56b commit aba031c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libs/csrf/csrfprotector.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@ public static function init($length = null, $action = null)
133133
self::$config['CSRFP_TOKEN'] = CSRFP_TOKEN;
134134

135135
// Validate the config if everythings filled out
136+
// TODO: collect all missing values and throw exception together
136137
foreach (self::$requiredConfigurations as $value) {
137138
if (!isset(self::$config[$value]) || self::$config[$value] == '') {
138-
throw new incompleteConfigurationException("OWASP CSRFProtector: Incomplete configuration file!");
139-
exit;
139+
throw new incompleteConfigurationException(
140+
sprintf(
141+
"OWASP CSRFProtector: Incomplete configuration file, Value: %s missing ",
142+
$value
143+
)
144+
);
140145
}
141146
}
142147

0 commit comments

Comments
 (0)