Numeric product slugs abort artifact composition (hash() given int)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 79/100
Línea de trabajo
Empieza en ArtifactCompiler::runtimeDeclarationsFromFallbacks() cerca de la línea 1533 y sigue cómo los slugs de producto se convierten en claves de $products. Comprueba si los demás mapas de la función cuyas claves son slugs o rutas sufren la misma conversión a claves enteras y, después, añade una fixture de regresión con un slug de producto numérico, como 249. Se considera terminado cuando la composición se completa correctamente y el ID de la entidad de producto calcula el hash de la cadena del slug.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Artifact composition aborts with TypeError: hash(): Argument #2 ($data) must be of type string, int given when a captured product has a numeric slug.
ArtifactCompiler::runtimeDeclarationsFromFallbacks() keys $products by product slug. PHP stores a numeric-string key such as "199" as an int, so the later loop
foreach ($products as $productSlug => &$product) {
$product['id'] = 'product:' . hash('sha256', $productSlug);
passes an int to hash() under strict_types=1 and the whole import fails in the compose phase (static_site_importer_direct_artifact_phase_failed). Same class as #3098.
Evidence
Square Online store whose product URLs end in numeric IDs (/product/<name>/249, /263, /264). Every one of 46 pages compiled; compose failed:
ArtifactCompiler.php:1533
#0 ArtifactCompiler.php(1533): hash('sha256', 199)
#1 ArtifactCompiler.php(478): ArtifactCompiler->runtimeDeclarationsFromFallbacks(Array, Array, 'website/index.h...', ...)
#2 StagedTransport.php(522): ArtifactCompiler->finalizeArtifact(...)
#3 StagedTransport.php(423): ArtifactCompiler->composeWithCssRuleTrees(...)
Reproduced with Static Site Importer 1.33.392 / php-transformer 0.45.264; the same lines are on trunk (v0.45.270). This matches a production import that failed during building on the same source.
Expected
A product whose slug is all digits composes like any other product; its entity id is product: + sha256 of the slug string.
Suggested fix
Treat slug keys as strings where they are read back (e.g. hash('sha256', (string) $productSlug)), and audit the other slug/route-keyed maps in the same function for the same int-key coercion. Regression fixture: a product grid fallback with one product whose slug is numeric (e.g. 249); compose succeeds and the product entity id is the hash of "249".
Filed by Claude (Anthropic) via Claude Code during the Data Liberation import loop; the stack trace was captured from a local reproduction.
- Lenguaje dominante
- PHP
- Estrellas
- 25
- Forks
- 3
- Merge medio
- 2 h 23 min
- PR fusionados (30 d)
- 942
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Automattic/blocks-engine
-
Captured slideshow pass overwrites the route path, aborting compose with a rebind() TypeErrorAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Automattic/blocks-engine#5003 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Automattic/blocks-engine#4943 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Automattic/blocks-engine#4942 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Automattic/blocks-engine#4921 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Automattic/blocks-engine#775 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Automattic/blocks-engine
Issues similares
-
enhancement priority Sales
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
web-token/jwt-framework#757 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Include flows spanning the full report time windowPosiblemente ocupada @somethingwithproof la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Cacti/plugin_flowview#306 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
wintercms/wn-sitemap-plugin#31 · 2 comentarios ·