From b08cdf459989f24727128c6643b65151ea976635 Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 13 Feb 2013 13:26:30 -0800 Subject: [PATCH 1/3] Add missing hsprintf() after merge Summary: rP4bd2ad Test Plan: None. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4939 --- .../PhabricatorProjectProfileEditController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectProfileEditController.php index ac1144eb3a..9c5901e2b1 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileEditController.php @@ -168,10 +168,12 @@ final class PhabricatorProjectProfileEditController ->setLabel(pht('Blurb')) ->setName('blurb') ->setValue($profile->getBlurb())) - ->appendChild('

'. - pht('NOTE: Policy settings are not yet fully implemented. '. - 'Some interfaces still ignore these settings, '. - 'particularly "Visible To".').'

') + ->appendChild(hsprintf( + '

%s

', + pht( + 'NOTE: Policy settings are not yet fully implemented. '. + 'Some interfaces still ignore these settings, '. + 'particularly "Visible To".'))) ->appendChild( id(new AphrontFormPolicyControl()) ->setUser($user) From 262abd39bc3268cd3bef976a69bcf5f5e75c4343 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 13 Feb 2013 12:56:15 -0800 Subject: [PATCH 2/3] Fix undefined variable "none" Summary: Assuming this is right? Test Plan: No more exception error when viewing a revision. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4937 --- .../differential/render/DifferentialChangesetHTMLRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index 3c8d90dcfd..b965b78fcd 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -21,7 +21,7 @@ abstract class DifferentialChangesetHTMLRenderer return null; } } else { - $none = $none; + $none = hsprintf(''); switch ($change) { case DifferentialChangeType::TYPE_ADD: From 4f42d85c1c096dcd8f68b44beffcf4fad01191d8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 13 Feb 2013 14:45:57 -0800 Subject: [PATCH 3/3] Use a serialize()-based cache instead of a JSON-based cache for changesets Summary: These are full of PhutilSafeHTML objects now, which are destroyed by JSON serialization. Test Plan: Dropped cache, then reloaded pages. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4942 --- .../parser/DifferentialChangesetParser.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php index 479af1b778..14b6b17ed1 100644 --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -63,7 +63,7 @@ final class DifferentialChangesetParser { return $this->disableCache; } - const CACHE_VERSION = 10; + const CACHE_VERSION = 11; const CACHE_MAX_SIZE = 8e6; const ATTR_GENERATED = 'attr:generated'; @@ -270,7 +270,13 @@ final class DifferentialChangesetParser { return false; } - $data = json_decode($data['cache'], true); + if ($data['cache'][0] == '{') { + // This is likely an old-style JSON cache which we will not be able to + // deserialize. + return false; + } + + $data = unserialize($data['cache']); if (!is_array($data) || !$data) { return false; } @@ -340,7 +346,7 @@ final class DifferentialChangesetParser { break; } } - $cache = json_encode($cache); + $cache = serialize($cache); // We don't want to waste too much space by a single changeset. if (strlen($cache) > self::CACHE_MAX_SIZE) {