Summary
HookRegistry registers handlers for two hook names — smwAskParserFunction and smwShowParserFunction — that do not exist in Semantic MediaWiki. As a result, the feature they implement (restricting source= queries to $seqlgExternalQueryEnabledNamespaces) never runs.
Details
src/HookRegistry.php registers a handler under both names:
$this->handlers['smwAskParserFunction'] = $this->handlers['smwShowParserFunction'] = static function ( $parser, $frame, $args, &$override ) {
// ... sets:
// $override = 'Warning: source parameter is not allowed in the namespace!'
// when the page's namespace is not in $GLOBALS['seqlgExternalQueryEnabledNamespaces']
};
This only does anything if Semantic MediaWiki fires hooks literally named smwAskParserFunction / smwShowParserFunction. Those names appear nowhere in the Semantic MediaWiki source tree, nor anywhere in its Git history, so the handlers are never invoked. The #ask / #show execution path (AskParserFunction / ShowParserFunction) does not run a hook of that name.
Impact
The $seqlgExternalQueryEnabledNamespaces namespace restriction is silently inert: a {{#ask: … |source=… }} (or {{#show:}}) query is not blocked in disallowed namespaces, contrary to what the setting documents.
This is pre-existing (identical on the current released code and on the SMW 7.0 branch) and was discovered during the SMW 7.0 migration (#44). The test suite does not catch it because HookRegistryTest only asserts the InterwikiLoadPrefix handler is registered, not that the ask/show guard fires.
Suggested next steps
- Confirm whether Semantic MediaWiki exposes an equivalent hook in a supported version that allows inspecting/overriding
#ask / #show parser-function invocations, and rewire the namespace guard to it; or
- If no such hook exists, remove the dead handlers and either implement the namespace restriction by another mechanism or update the
$seqlgExternalQueryEnabledNamespaces documentation accordingly.
- Add test coverage for whichever path is chosen so the guard cannot silently regress again.
Summary
HookRegistryregisters handlers for two hook names —smwAskParserFunctionandsmwShowParserFunction— that do not exist in Semantic MediaWiki. As a result, the feature they implement (restrictingsource=queries to$seqlgExternalQueryEnabledNamespaces) never runs.Details
src/HookRegistry.phpregisters a handler under both names:This only does anything if Semantic MediaWiki fires hooks literally named
smwAskParserFunction/smwShowParserFunction. Those names appear nowhere in the Semantic MediaWiki source tree, nor anywhere in its Git history, so the handlers are never invoked. The#ask/#showexecution path (AskParserFunction/ShowParserFunction) does not run a hook of that name.Impact
The
$seqlgExternalQueryEnabledNamespacesnamespace restriction is silently inert: a{{#ask: … |source=… }}(or{{#show:}}) query is not blocked in disallowed namespaces, contrary to what the setting documents.This is pre-existing (identical on the current released code and on the SMW 7.0 branch) and was discovered during the SMW 7.0 migration (#44). The test suite does not catch it because
HookRegistryTestonly asserts theInterwikiLoadPrefixhandler is registered, not that the ask/show guard fires.Suggested next steps
#ask/#showparser-function invocations, and rewire the namespace guard to it; or$seqlgExternalQueryEnabledNamespacesdocumentation accordingly.