diff --git a/src/UsingDataHooks.php b/src/UsingDataHooks.php index f9c0690..6295552 100644 --- a/src/UsingDataHooks.php +++ b/src/UsingDataHooks.php @@ -138,10 +138,10 @@ static function ( Parser $dataParser ) use ( $text, $title, $parser ) { } private function makeDataParserAndRun( Parser $parser, callable $callback ): void { - $hookRunnerProperty = new ReflectionProperty( $parser, 'hookRunner' ); + $hookRunnerProperty = new ReflectionProperty( Parser::class, 'hookRunner' ); $originalHookRunner = $hookRunnerProperty->getValue( $parser ); - $hookContainerProperty = new ReflectionProperty( $originalHookRunner, 'container' ); + $hookContainerProperty = new ReflectionProperty( HookRunner::class, 'container' ); $hookContainer = $hookContainerProperty->getValue( $originalHookRunner ); $newHookRunner = new class ( $hookContainer ) extends HookRunner { @@ -151,6 +151,7 @@ public function onParserClearState( $parser ): bool { }; try { + $this->isInDataSearchMode = true; $dataParser = clone $parser; $hookRunnerProperty->setValue( $dataParser, $newHookRunner ); $callback( $dataParser );