From 176ee9a889df4c7515b7d95d899341a446f517b8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 Feb 2013 13:09:19 -0800 Subject: [PATCH] Fix {Fnnn} rule in Remarkup Summary: Remarkup rule callbacks now get SafeHTML matches instead of string matches. If they call: $some_lisk_dao->load($matches[1]); ..as is the case with the `{F123}` rule, we reject the SafeHTML as an invalid ID and return null. Allow load() to string convert any object (which will either succeed or fatal in an obviously-broken way). (Long ago we threw instead of returning null here, but it meant we had to do a lot of redundant checks.) Test Plan: `{F123}` shows an image again. `{C1}` embeds a countdown. Reviewers: vrana, chad Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4961 --- src/infrastructure/markup/PhabricatorMarkupEngine.php | 2 +- src/infrastructure/storage/lisk/LiskDAO.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index f242519c18..d0c8545809 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -41,7 +41,7 @@ final class PhabricatorMarkupEngine { private $objects = array(); private $viewer; - private $version = 3; + private $version = 4; /* -( Markup Pipeline )---------------------------------------------------- */ diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php index 095b39a523..a1db91d95d 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -406,6 +406,10 @@ abstract class LiskDAO { * @task load */ public function load($id) { + if (is_object($id)) { + $id = (string)$id; + } + if (!$id || (!is_int($id) && !ctype_digit($id))) { return null; }