Allow underscores to appear in Harbormaster variable names
Summary:
See PHI859. Ref T13195. The regexp for replacing variables currently does not include underscores.
Include underscores.
I also made a note in T13088: we should (almost certainly?) throw immediately if you try to pass a bogus variable name as a custom parameter, but this is a slightly larger change.
Test Plan:
- Made an "http request" build plan with `?x=${initiator.phid}&y={$some_variable}`.
- Added `some_variable` as a parameter to the parameter collection.
- Before patch: `initiator.phid` was replaced, but `some_variable` was not.
- After patch: both variables are replaced.
Reviewers: amckinley
Reviewed By: amckinley
Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam
Maniphest Tasks: T13195
Differential Revision: https://secure.phabricator.com/D19645
This commit is contained in:
@@ -193,7 +193,7 @@ abstract class HarbormasterBuildStepImplementation extends Phobject {
|
||||
* @return string String with variables replaced safely into it.
|
||||
*/
|
||||
protected function mergeVariables($function, $pattern, array $variables) {
|
||||
$regexp = '@\\$\\{(?P<name>[a-z\\./-]+)\\}@';
|
||||
$regexp = '@\\$\\{(?P<name>[a-z\\./_-]+)\\}@';
|
||||
|
||||
$matches = null;
|
||||
preg_match_all($regexp, $pattern, $matches);
|
||||
|
||||
Reference in New Issue
Block a user