Repository navigation
fix(maker): keep generated and updated files valid - #11
Merged
Merged
Conversation
make:sympress-package decoded the root composer.json into PHP arrays,
so empty objects such as "require-dev": {}, "extra": {} or
"config.allow-plugins": {} were written back as []. Composer then
rejects the file with a schema error on every command. Decode into
stdClass instead and only touch the require section being updated.
New definitions were appended to the end of services.yaml. When another top-level key such as "when@dev:" or "parameters:" followed "services:", the class landed under that key and was silently never registered. Insert before the next top-level key instead, add a services block when none exists, and fail with a hint when "services" is not a block mapping.
ltrim($sourcePath, './') removes a character set, not a prefix. A path like "./.config/x.ts" became "config/x.ts" and "../x.ts" became "x.ts", so the source file was created somewhere other than the path written to webpack.config.js, and a leading ".." was swallowed instead of rejected.
The generated webpack.config.js negated the function reference Encore.isProduction instead of calling it, so the condition was always false and stale bundles were never cleaned from the output directory.
make:block encoded an empty PHP array, producing "attributes": [] while
the block.json schema expects an object. Emit {} instead.
SourceLiteral::javascript() left json_encode()'s "\/" escapes in place, so generated webpack entries and block sources read '.\/Resources\/...'. JSON_HEX_TAG already neutralises "</script>", so the slash escape adds nothing.
PackageContext::relativePath() stripped the project prefix without the traversal and symlink checks that packageRelativePath() applies. When a package directory was a symlink to a target outside the project, the service and webpack.config.js updates were still written there. Route the result through ProjectPath::relative() like the other helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Fable re-audit (2026-11-22) found several cases where makers write broken or misplaced files:
make:sympress-packagerewrote empty objects in the rootcomposer.jsonas[]→ Composer schema error on every command (Medium).services.yaml; a followingwhen@dev:/parameters:key swallowed them silently (Low).ltrim($path, './')inmake:asset-entrystripped a character set:./.config/x.ts→config/x.ts,../x.ts→x.ts(Low).webpack.config.jsnegatedEncore.isProductioninstead of calling it, so output cleanup never ran (Low).block.jsonhad"attributes": []; JS literals contained\/(Info).PackageContext::relativePath()skipped the symlink/traversal checks used bypackageRelativePath()(Info, hardening).Fix
One commit per finding: decode root
composer.jsonintostdClass(JsonFile::readObject(),encode()acceptsstdClass); insert YAML definitions before the next top-level key (add aservices:block if missing, fail with a hint for inlineservices:); strip only a leading./; callEncore.isProduction(); emit{}for attributes andJSON_UNESCAPED_SLASHES; routerelativePath()throughProjectPath::relative().Tests
Regression test per fix, each verified to fail on
mainand pass here (newPackageServiceConfiguratorTest,WebpackEncoreEntryConfiguratorTest, extendedMakerInputSafetyTest/GeneratedSourceSafetyTest). Local:composer qagreen (PHPCS, PHPStan, 30 tests / 202 assertions),composer validate --strictOK. Manually checked that a rewritten rootcomposer.jsonwith empty objects passescomposer validate.Release
Patch release 1.0.5 (
chore(release): prepare 1.0.5); changelog also covers the unreleased Dependabot CI commit and drops the stale "Unreleased — Initial…" section.