From da6e75c1b12f31cd980b358367dd71bad9813e05 Mon Sep 17 00:00:00 2001 From: Bram de Leeuw Date: Wed, 4 Sep 2019 10:22:29 +0200 Subject: [PATCH] Fix injection on Form posts In use with Silvershop, a form post from the AddProductForm would pass the form trough the `afterCallActionHandler` as the `$result`. This causes the `getValue` to error. By checking if the result is an instance of `DBHTMLText` this error can't happen anymore. --- src/Extension/BetterNavigatorExtension.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Extension/BetterNavigatorExtension.php b/src/Extension/BetterNavigatorExtension.php index a68f88e..1297618 100644 --- a/src/Extension/BetterNavigatorExtension.php +++ b/src/Extension/BetterNavigatorExtension.php @@ -50,6 +50,10 @@ class BetterNavigatorExtension extends DataExtension return $result; } + if (!($result instanceof DBHTMLText)) { + return $result; + } + $html = $result->getValue(); $navigatorHTML = $this->generateNavigator()->getValue();