| Age | Commit message (Collapse) | Author |
|
The Cargo.toml section-header pattern only matched single-bracket
headers, so a `[[bench]]` / `[[bin]]` / `[[test]]` table left the
previous section active and its keys were attributed to whatever
`[dependencies]` block preceded it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PHP keeps three separate environment storages and docs/dev/env-vars-
porting.md maps each to its own shim construct. Reaching for std::env
silently picks one, so the porting target has to be chosen by reading
the PHP source rather than by whichever Rust call is at hand.
Detect var/var_os/vars/vars_os/set_var/remove_var. current_dir, args,
consts, temp_dir, current_exe and the path split/join helpers are not
environment storage and stay allowed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
`__halt_compiler` is a PHP keyword, so a stub may spell the token in any
letter case. The native phar reader compared the bytes exactly and rejected
such an archive, and the lint that keeps a second token out of the
executable missed lowercase ones, which would shadow the embedded bundle.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Plugins and scripts need the real `Composer\` classes and the packages
Composer depends on, which so far came from a checkout found through
SHIRABE_COMPOSER_PHP_DIR or a path next to the workspace. Neither exists
for a distributed binary.
The build script now archives those PHP sources into a phar the way
Compiler.php does and the executable carries it. The worker maps it with
Phar::loadPhar and reads a content-addressed sentinel back to tell a
bundle it can use from one it cannot; where its PHP cannot open the phar,
the bundle is unpacked once into the cache directory and autoloaded from
there. SHIRABE_COMPOSER_PHP_DIR still overrides both for development.
PHP locates a phar's manifest by the first __HALT_COMPILER(); token in
the file, so the executable must hold no other copy of it: phar.rs builds
the token at run time, and a linter keeps further literals out of the
sources that reach the binary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Ported exceptions were flat structs reached with `downcast_ref`, so
Composer's `catch (\RuntimeException $e)` only matched the exact leaf
type and `get_class($e)` had nothing to report. Each exception now
embeds an instance of the class it extends and travels inside an
`AnyThrowable`; `Catch::catch`/`catch_mut` walk that chain, and
`PhpClass::php_class_name` yields the PHP FQCN.
Dropping the `std::error::Error` impls from the exception types leaves
`AnyThrowable` as the only route into an `anyhow::Error`, so the walk
cannot be bypassed. A `no_exception_downcast` linter catches the
`downcast::<X>()` calls that would now silently answer `None`.
Three sites change behavior as a result: the `TransportException`
exit-code override reaches `MaxFileSizeExceededException`, the
`catch (\LogicException)` in findSimilar() reaches its subclasses, and
rendered exception titles carry the real class name rather than a
guess. `get_class_err()` is no longer a `todo!()`, which re-enables
FilesystemRepositoryTest::testCorruptedRepositoryFile.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The audit in .ken/php-shim-copying.md judged 14 functions in
shirabe-php-shim (plus php_wordwrap in shirabe-external-packages) to be
line-by-line transcriptions or structural imitations of php-src. PHP's
relicensing to 3-clause BSD makes keeping them legal, but the boundary
between BSD-derived and MIT code was invisible in the source tree.
Moving them into their own crate puts the license into the build
metadata (so NOTICE generation follows the binary), makes a reverse
dependency a compile error, and encodes the origin in the module path,
which mirrors php-src's ext tree. Each function records its origin in a
fixed-format doc comment, and a new php_src_derivation_boundary linter
fails if `php-src` appears in any Rust source outside the crate.
Public paths under shirabe_php_shim:: are unchanged: functions that are
themselves derived are re-exported with `pub use`, and the wrappers that
only validate arguments stay on the MIT side.
This also resolves the duplicate wordwrap implementation.
shirabe_php_shim::wordwrap was todo!(), so SymfonyStyle::block panicked,
while shirabe-external-packages carried its own copy. Both now go
through the single port, verified against real PHP on 13 cases covering
multi-character breaks and cut.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Fold scripts/lint and scripts/linters/*.rb into a standalone Composer
project under scripts/linters/, matching the scripts/plugin-class-classifier/
convention. Uses no external packages, only PHP + Composer autoloading.
Verified byte-for-byte identical output against the original Ruby
implementation, both on the current repo (all linters pass) and on a
synthetic fixture exercising every violation type.
Entry point moves from `scripts/lint` to `scripts/linters/lint`.
|