Skip to content

Commit f331c7d

Browse files
committed
Fix syntax error on PHP < 5.6 (again !)
Same problem as 9d63c3b... Define regex as a single string constant, and move the documentation to the property's PHPDoc block. Fixes #199
1 parent bce232f commit f331c7d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Source/MantisSourceGitBasePlugin.class.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ abstract class MantisSourceGitBasePlugin extends MantisSourcePlugin
1818
* Git branch name validation regex.
1919
* Based on rules defined in man page
2020
* http://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
21+
* - Must not start with '/'; cannot contain '/.', '//', '@{' or '\';
22+
* cannot be a single '@': `^(?!/|.*([/.]\.|//|@\{|\\\\)|@$)`
23+
* - One or more chars, except the following: ASCII control, space,
24+
* tilde, caret, colon, question mark, asterisk, open bracket:
25+
* `[^\000-\037\177 ~^:?*[]+`
26+
* - Must not end with '.lock', '/' or '.': `(?<!\.lock|[/.])$`
2127
*/
22-
private $valid_branch_regex = '%'
23-
# Must not start with '/'; cannot contain '/.', '//', '@{' or '\';
24-
# cannot be a single '@'.
25-
. '^(?!/|.*([/.]\.|//|@\{|\\\\)|@$)'
26-
# One or more chars, except the following: ASCII control, space,
27-
# tilde, caret, colon, question mark, asterisk, open bracket.
28-
. '[^\000-\037\177 ~^:?*[]+'
29-
# Must not end with '.lock', '/' or '.'
30-
. '(?<!\.lock|[/.])$'
31-
. '%';
28+
private $valid_branch_regex = '%^(?!/|.*([/.]\.|//|@\{|\\\\)|@$)[^\000-\037\177 ~^:?*[]+(?<!\.lock|[/.])$%';
3229

3330
/**
3431
* Error constants

0 commit comments

Comments
 (0)