Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391801
D21810.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D21810.id.diff
View Options
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -46,6 +46,8 @@
private $engineCaches = array();
private $auxiliaryConfig = array();
+ private static $engineStack = array();
+
/* -( Markup Pipeline )---------------------------------------------------- */
@@ -103,6 +105,24 @@
* @task markup
*/
public function process() {
+ self::$engineStack[] = $this;
+
+ try {
+ $result = $this->execute();
+ } finally {
+ array_pop(self::$engineStack);
+ }
+
+ return $result;
+ }
+
+ public static function isRenderingEmbeddedContent() {
+ // See T13678. This prevents cycles when rendering embedded content that
+ // itself has remarkup fields.
+ return (count(self::$engineStack) > 1);
+ }
+
+ private function execute() {
$keys = array();
foreach ($this->objects as $key => $info) {
if (!isset($info['markup'])) {
diff --git a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
--- a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
+++ b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
@@ -126,6 +126,12 @@
return $this->renderObjectTagForMail($name, $href, $handle);
}
+ // See T13678. If we're already rendering embedded content, render a
+ // default reference instead to avoid cycles.
+ if (PhabricatorMarkupEngine::isRenderingEmbeddedContent()) {
+ return $this->renderDefaultObjectEmbed($object, $handle);
+ }
+
return $this->renderObjectEmbed($object, $handle, $options);
}
@@ -133,6 +139,12 @@
$object,
PhabricatorObjectHandle $handle,
$options) {
+ return $this->renderDefaultObjectEmbed($object, $handle);
+ }
+
+ final protected function renderDefaultObjectEmbed(
+ $object,
+ PhabricatorObjectHandle $handle) {
$name = $handle->getFullName();
$href = $handle->getURI();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 11:41 AM (2 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7363398
Default Alt Text
D21810.id.diff (2 KB)
Attached To
Mode
D21810: Prevent embedded remarkup content from cycling when it contains embedded self-references
Attached
Detach File
Event Timeline
Log In to Comment