From 24a061f844958cc22d6f4874535b57574a6c13c3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 1 Nov 2018 19:55:03 -0700 Subject: [PATCH] Correct an ambiguous regexp in DiffusionRequest Summary: See . The intent of `[\d-,]` is "digits, hyphen, and comma" but `[x-y]` means "character range x-y". Specify `[\d,-]` instead to disambiguate the hyphen as "literal hyphen", not a character range marker. Test Plan: I can't reproduce the original error as reported, but browsed around Diffusion for a bit. Reviewers: amckinley, avivey Reviewed By: avivey Differential Revision: https://secure.phabricator.com/D19770 --- src/applications/diffusion/request/DiffusionRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php index 1a46d43adf..52a09d12ae 100644 --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -489,7 +489,7 @@ abstract class DiffusionRequest extends Phobject { // Consume the back part of the URI, up to the first "$". Use a negative // lookbehind to prevent matching '$$'. We double the '$' symbol when // encoding so that files with names like "money/$100" will survive. - $pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d-,]+)$@'; + $pattern = '@(?:(?:^|[^$])(?:[$][$])*)[$]([\d,-]+)$@'; if (preg_match($pattern, $blob, $matches)) { $result['line'] = $matches[1]; $blob = substr($blob, 0, -(strlen($matches[1]) + 1));