@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+1 -1
+1 -1
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
··· 193 193 * @return string String with variables replaced safely into it. 194 194 */ 195 195 protected function mergeVariables($function, $pattern, array $variables) { 196 - $regexp = '@\\$\\{(?P<name>[a-z\\./-]+)\\}@'; 196 + $regexp = '@\\$\\{(?P<name>[a-z\\./_-]+)\\}@'; 197 197 198 198 $matches = null; 199 199 preg_match_all($regexp, $pattern, $matches);