Page MenuHomePhabricator

When using a PhabricatorRemarkupCustomInlineRule with caching disabled, custom rules may end up with incorrect engines
Closed, ResolvedPublic

Description

Repro steps:

  1. Create a custom rule such as P1129 - The rule must call $this->getEngine()->storeText [Or something similar that interacts with its engine's storage]
  2. Create a maniphest task such that the description triggers the custom rule
  3. Visit the maniphest when the maniphest is not within the cache [I was testing by modifying https://secure.phabricator.com/diffusion/P/browse/stable/src/infrastructure/markup/PhabricatorMarkupEngine.php;864d3984ebdb42b9a2670103ca3607342e46b7dc$246 to read if (false)]

Expected:
Maniphest is processed and displayed appropriatly

Actual:
The engine used by the custom rule is not the same as the engine within the block calling applyRules, as a result the custom rule is referencing an Engine that has no storage, and causes the following error to occur

>>> UNRECOVERABLE FATAL ERROR <<<

Call to a member function store() on a non-object

/Users/quazie/code/phab/libphutil/src/markup/engine/PhutilRemarkupEngine.php:84


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻

Event Timeline

epriestley claimed this task.
epriestley added a subscriber: epriestley.

Sorry, we don't offer support for custom development. See Support Resources and Contributing Bug Reports for details.

We do NOT support custom code development or third-party libraries. If you're writing an extension, you're on your own.

D15535 should completely fix this in all cases

@eadler, you should be able to strip out any of the engine shenanigans once you pick that up if you applied them locally.

@20after4, I think https://gerrit.wikimedia.org/r/#/c/236417/ never went to production and is like 35 years old now and I can't find it anywhere published, but it can be dropped if it did make it into the wild somewhere.