Skip to content

Commit 5f468c0

Browse files
committed
Cleaner removePassword regex
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
1 parent aec9c84 commit 5f468c0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/private/Log/ErrorHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ErrorHandler {
3939
* @return string
4040
*/
4141
protected static function removePassword($msg) {
42-
return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
42+
return preg_replace('#//(.*):(.*)@#', '//xxx:xxx@', $msg);
4343
}
4444

4545
public static function register($debug = false) {

tests/lib/ErrorHandlerTest.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ class ErrorHandlerTest extends \Test\TestCase {
3030
*/
3131
public function passwordProvider() {
3232
return [
33-
['user', 'password'],
34-
['user@owncloud.org', 'password'],
35-
['user', 'pass@word'],
33+
['us:er', 'pass@word'],
3634
['us:er', 'password'],
35+
['user', '-C:R,w)@6*}'],
3736
['user', 'pass:word'],
37+
['user', 'pass@word'],
38+
['user', 'password'],
39+
['user:test@cloud', 'password'],
40+
['user@owncloud.org', 'password'],
41+
['user@test@owncloud.org', 'password'],
3842
];
3943
}
4044

0 commit comments

Comments
 (0)