From 150f711cc8026f6f3b6fa1991faa8dedf1c81d1d Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 29 Nov 2012 06:05:35 -0800 Subject: [PATCH] Make `drydock` case sensitive in attribute parsing Summary: See D4047. Get rid of this strtolower() junk. Test Plan: ``` $ /bin/drydock lease --type working-copy --attributes repositoryID=12 Acquired Lease 66 ``` Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D4048 --- .../drydock/management/DrydockManagementLeaseWorkflow.php | 1 + src/applications/drydock/storage/DrydockLease.php | 4 ++-- .../__tests__/CelerityResourceTransformerTestCase.php | 3 ++- .../markup/rule/PhabricatorRemarkupRuleEmbedFile.php | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php index 616239eeb7..9df072d88e 100644 --- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php @@ -34,6 +34,7 @@ final class DrydockManagementLeaseWorkflow $attributes = $args->getArg('attributes'); if ($attributes) { $options = new PhutilSimpleOptions(); + $options->setCaseSensitive(true); $attributes = $options->parse($attributes); } diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php index de0ebf9bf6..fd657f6319 100644 --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -26,12 +26,12 @@ final class DrydockLease extends DrydockDAO { } public function setAttribute($key, $value) { - $this->attributes[strtolower($key)] = $value; + $this->attributes[$key] = $value; return $this; } public function getAttribute($key, $default = null) { - return idx($this->attributes, strtolower($key), $default); + return idx($this->attributes, $key, $default); } public function generatePHID() { diff --git a/src/infrastructure/celerity/__tests__/CelerityResourceTransformerTestCase.php b/src/infrastructure/celerity/__tests__/CelerityResourceTransformerTestCase.php index 6dd3d772e3..883e415540 100644 --- a/src/infrastructure/celerity/__tests__/CelerityResourceTransformerTestCase.php +++ b/src/infrastructure/celerity/__tests__/CelerityResourceTransformerTestCase.php @@ -15,7 +15,8 @@ final class CelerityResourceTransformerTestCase extends PhabricatorTestCase { list($options, $in, $expect) = $parts; - $options = PhutilSimpleOptions::parse($options) + array( + $parser = new PhutilSimpleOptions(); + $options = $parser->parse($options) + array( 'minify' => false, 'name' => $name, ); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php index 0f5ba3cbb0..7a92eada96 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php @@ -43,7 +43,8 @@ final class PhabricatorRemarkupRuleEmbedFile if (!empty($matches[2])) { $matches[2] = trim($matches[2], ', '); - $options = PhutilSimpleOptions::parse($matches[2]) + $options; + $parser = new PhutilSimpleOptions(); + $options = $parser->parse($matches[2]) + $options; } $file_name = coalesce($options['name'], $file->getName()); $options['name'] = $file_name;