Fix iOS extraction of emoji-named files (Livewire 4 ⚡️ components)#138
Merged
Conversation
ZIPFoundation 0.9.19's `entry.path` ignores the archive's preferredEncoding
and falls back to CP437 whenever the entry's EFS bit is unset — which macOS
`zip` often omits even for UTF-8 names. The result was that files like
`⚡️counter.blade.php` (Livewire 4 components) were extracted into the iOS
data container as `⚡️counter.blade.php`, and PHP autoloaders couldn't
find them.
- Force UTF-8 filename decode via `entry.path(using: .utf8)` with a fallback
to `entry.path` if the bytes aren't valid UTF-8.
- Normalize entry paths to NFC before writing, so NFD filenames coming from
macOS sources don't end up on iOS APFS in a form PHP can't look up.
- Surface zip stderr in BuildIosAppCommand instead of a bare "Failed to
create ZIP file" exception.
- Add `native:sim {data|app|uninstall}` to open the booted simulator's
data/app containers in Finder, or uninstall the app (with confirmation).
This was the tool that made the bug diagnosable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
PHP files with non-ASCII names — most visibly Livewire 4 components prefixed with
⚡️— were unusable on iOS. The extracted Laravel app on the simulator contained files named e.g.ΓÜí∩╕Åcounter.blade.phpinstead of⚡️counter.blade.php, so autoloading and view resolution silently failed.Root cause: ZIPFoundation 0.9.19's
entry.pathignores the archive'spreferredEncodingand falls back to CP437 whenever the entry's EFS bit (general-purpose bit 11) is unset. macOSzipoften omits that flag even when the bytes are valid UTF-8, so every non-ASCII filename came out mojibake'd.Changes
resources/xcode/NativePHP/AppUpdateManager.swiftentry.path(using: .utf8), with a fallback toentry.pathonly if the bytes aren't valid UTF-8.src/Commands/BuildIosAppCommand.phpcreateAppZip()fails, instead of throwing a bare "Failed to create ZIP file".src/Commands/SimCommand.php+src/NativeServiceProvider.php(new command)php artisan native:sim data— opens the booted simulator's data container in Finderphp artisan native:sim app— opens the parent of the.appbundle (soapp.zipis visible next toNativePHP.app)php artisan native:sim uninstall— uninstalls the app from the booted simulator (with confirmation)--bundle-id=overrides the configuredNATIVEPHP_APP_IDThe
native:simcommand was built to diagnose this bug, but it's broadly useful for inspecting simulator state during development, so it's included here.Heads-up for reviewers
Changes under
resources/xcode/only reach consumer projects viaphp artisan native:install, which snapshots the template intonativephp/ios/. Anyone iterating on this fix locally needs to re-runnative:install(or--force) for the Swift changes to actually get compiled.Test plan
⚡️counter.blade.php)php artisan native:install --forceto copy the updated Swift into the iOS projectphp artisan native:sim uninstallto clear any stale extractionphp artisan native:run iosphp artisan native:sim data→ confirm the file name shows with the real emoji, and thatxxdof the filename showse2 9a a1 ef b8 8f(UTF-8 for ⚡️)php artisan native:sim appopens Finder at the.appparent dirphp artisan native:sim uninstallprompts for confirmation and successfully removes the app🤖 Generated with Claude Code