From 8c0e5e1c58d18f527502a27cf0c8d1db75a2405f Mon Sep 17 00:00:00 2001 From: Nicholas Harper Date: Thu, 25 Aug 2011 15:17:12 -0700 Subject: [PATCH] Turn off write guard when saving differential comment cache Summary: It is possible to view a comment that has no cache; when viewing such a comment the request doesn't have a csrf token and there is no need for one, so we turn off the write guard. Test Plan: loaded an old diff that had no cache, and the page loaded instead of throwing an AphrontCSRFException. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: 858 --- .../view/revisioncomment/DifferentialRevisionCommentView.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php b/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php index 723322fc5b..74c7a853c6 100644 --- a/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php +++ b/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php @@ -195,7 +195,9 @@ final class DifferentialRevisionCommentView extends AphrontView { $inline_content); if ($inline->getID()) { $inline->setCache($inline_content); + $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $inline->save(); + unset($unguarded); } } }