Numeric product slugs abort artifact composition (hash() given int)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
Research direction
Start in ArtifactCompiler::runtimeDeclarationsFromFallbacks() around line 1533 and trace how product slugs become keys in $products. Check the other slug or route keyed maps in that function for the same integer key coercion, then add a regression fixture with a numeric product slug such as 249. Done means composition succeeds and the product entity ID hashes the slug string.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- PHP
- Stars
- 25
- Forks
- 3
- Avg merge
- 2h 29m
- Merged PRs (30d)
- 931
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/blocks-engine#4874 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
-
Shared-chrome CSS factoring merges device-document stylesheets, so phones render the desktop widthOpen
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Automattic/blocks-engine#4894 ·
Maintainers usually reply within 1 day
-
non core block: layout-shell@a[data-testid][href][target]Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 46/100
Automattic/blocks-engine#4888 ·
Maintainers usually reply within 1 day
-
non core block: layout-shell@div[data-bg-effect-name][data-has-ssr-src][data-image-info][data-motion-part]Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Automattic/blocks-engine#4887 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
GSA/digital-gov-drupal#569 ·
Maintainers usually reply within 2 days
-
feature-request-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Codeinwp/wp-menu-icons#360 ·
-
[Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 5 days