Skip to content
Snippets Groups Projects
Commit 6f29e4fe authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Fix for issue #555. Avoid usage of anonymous functions for backwards...

Fix for issue #555. Avoid usage of anonymous functions for backwards compatibility with PHP versions prior to 5.3.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3255 44740490-163a-0410-bde0-09ae8108e29a
parent 8847ea31
No related branches found
No related tags found
No related merge requests found
......@@ -136,10 +136,24 @@ class sspmod_core_Auth_Process_GenerateGroups extends SimpleSAML_Auth_Processing
assert('is_string($string)');
return preg_replace_callback('/([^a-zA-Z0-9_@=.])/',
function ($m) { return sprintf("%%%02x", ord($m[1])); },
'self::escapeIllegalChar',
$string);
}
/**
* Escapes a single special character.
*
* This function is used as a callback by escapeIllegalChars.
*
* @param array $matches The matches array provided by
* preg_*() functions. $matches[0] is the complete match, while
* $matches[1] is the specific subpattern enclosed in parenthesis
* that triggers the match.
*/
private static function escapeIllegalChar($matches) {
return sprintf("%%%02x", ord($matches[1]));
}
}
?>
\ No newline at end of file
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment