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
This commit is contained in:
@@ -41,7 +41,7 @@ final class PhabricatorMarkupEngine {
|
||||
|
||||
private $objects = array();
|
||||
private $viewer;
|
||||
private $version = 3;
|
||||
private $version = 4;
|
||||
|
||||
|
||||
/* -( Markup Pipeline )---------------------------------------------------- */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user