Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Namespace restriction for source= queries is inert: smwAskParserFunction/smwShowParserFunction hooks do not exist

Abierto
#45 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
php
Área
backend

Línea de trabajo

Comienza en src/HookRegistry.php e inspecciona los handlers registrados smwAskParserFunction y smwShowParserFunction. Comprueba si un hook compatible de Semantic MediaWiki puede inspeccionar o sobrescribir las llamadas #ask y #show, y después revisa HookRegistryTest.php. Se considera terminado cuando la restricción de namespace funciona mediante una ruta compatible, o cuando se actualizan los handlers sin uso y la documentación, con cobertura de regresión.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
PHP
Estrellas
9
Forks
8
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SemanticMediaWiki/SemanticExternalQueryLookup

Todos los issues de SemanticMediaWiki/SemanticExternalQueryLookup

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.