| Age | Commit message (Collapse) | Author |
|
PHP_INT_MAX/MIN/SIZE have exact Rust counterparts under the int -> i64
mapping, so the call sites use i64::MAX directly. PHP_INT_SIZE is
queried from the PHP runtime where it is actually needed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Output buffering captures whatever the PHP interpreter would echo to
stdout. The shim routes no output through a buffer, so these functions
could never capture anything and stayed todo!(). Record the gap in
docs/known-incompatibilities.md instead.
|
|
The SignalHandler port was a no-op stub, so all four of Composer's abort
paths were dead code: nothing removed a half-created project, reverted
composer.json, or cleaned up half-installed packages.
Composer runs those handlers from pcntl callbacks, which a Rust signal
handler cannot do -- it may touch nothing beyond atomics. SignalSubscription
records the signal instead, and the abort runs from checkpoints on the normal
call stack, where the clean-up can borrow the state it needs. That also
resolves the closure-capture TODO(phase-c)s in RequireCommand and
InstallationManager, and replaces exit_with_last_signal's exit(0) with the
restore-and-re-raise Seld\Signal does.
A subscription is live only inside the four abort regions, so elsewhere the
signals keep their default disposition and kill the process at once. It is
installed without SA_RESTART so a signal interrupts an interactive prompt
rather than resuming the read. A signal reaches only the innermost
subscription, reproducing SignalHandler's single-stack dispatch.
Drop SignalRegistry, SignalableCommandInterface and the Application wiring
for them: nothing in Composer reaches that path, and SignalHandler discards
whatever they register. Signal handling from plugins and scripts is
undefined behavior; see docs/dev/signals.md.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Composer's Composer\Util\TlsHelper is marked deprecated for removal in
Composer 3.0 and has no caller in composer/composer outside its own
test: PHP's stream layer verifies certificate hostnames itself, and the
one surviving method delegates to composer/ca-bundle.
The Rust port had no caller either, so it, its test, and the
openssl_x509_parse shim it was the sole user of are removed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
`Application::do_run` registers a `composer.json` script whose value names a
`Symfony\Component\Console\Command\Command` subclass as a live command. The
class checks and `new $dummy($script)` need a real PHP runtime, so they run in
the worker: the command object lives there and this side keeps a metadata
mirror for `list`/`help`, forwarding a run to the worker-side console
application it is added to. The name and description fixups are applied to the
worker-side object, so both sides carry the same values.
Loading the Composer PHP runtime into the worker is gated on the Rust-side
`ClassLoader`s resolving the class to a file, keeping that load out of every
run whose scripts are plain shell commands.
The worker-side console application handoff now accepts commands registered
after it was published, since the scripts scan runs after plugin commands are
collected. Whether it was published is tracked per application: the handoff is
process-wide, so a second application must replace it rather than extend it.
`shirabe_php_shim::is_subclass_of` has no callers left.
|
|
ClassLoader's PSR-0 include_path lookup went through a shim stub that could
only have answered with an invented include_path: the setting is PHP runtime
state, and the one thing that turns useIncludePath on is the generated
autoload_real.php, whose set_include_path() call runs inside the worker.
Ask the worker instead, so the search sees the same path list as the process
that ends up including the resolved file.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The real port lives in shirabe-php-rpc as __shirabe_composer_require(),
which runs inside the PHP worker where $GLOBALS and `require` exist.
Record that pointer in the module doc instead of keeping a stub that
can never be implemented on the Rust side.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Every parent module in the symfony-* crates already re-exported its leaf
modules with `pub use`, so each item was reachable by two paths. Make the
leaf modules private and route all callers through the single re-exported
path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
fileperms swallowed metadata errors and reported a mode of 0, which the
callers could not tell apart from a real (if implausible) mode: the zip
archiver stored entries with no permission bits, and Filesystem::copy
chmod-ed the target to 0. It now returns Result<u32, io::Error> so both
callers propagate the failure. The switch to u32 also drops the casts
around the mode arithmetic and ZipArchive's entry attributes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Composer restarts itself with Xdebug unloaded because Xdebug makes PHP
several times slower. Xdebug is never loaded into this process, so what
needs dealing with is the PHP worker: it is spawned with
`-d xdebug.mode=off` and `XDEBUG_MODE=off` (Xdebug reads the environment
variable first and lets it override every ini setting), which makes its
module init return before it installs any executor, compile, error or
opcode hook.
Rewriting the ini files and re-executing, the way xdebug-handler does,
would additionally cover Xdebug 2, which hooks unconditionally and has no
equivalent setting. That is not worth its machinery here: Xdebug 2 caps
out at PHP 7.4, while every PHP version Composer supports can run
Xdebug 3.
What remains of XdebugHandler is small enough to live beside the worker
it governs, so its crate is gone and its callers inline it. isXdebugActive
answers false without asking PHP whenever the worker is switched off, so a
command that needs no PHP does not spawn one just for the Xdebug warning;
diagnose reports what the worker measures instead, which still surfaces an
Xdebug that ignores the setting. PlatformRepository has no unloaded
extension to restore, since switching the mode off leaves it loaded.
COMPOSER_ORIGINAL_INIS is neither written nor read: it exists so a
restarted process can name the ini files it replaced, and IniHelper can
report the worker's own. IniHelperTest injects through that variable, so
none of its cases are ported.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The MIT packages Composer and Shirabe are ported from require their
copyright notices to be kept, and the Composer notice was only reachable
through the submodule.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
They were copied at run time from a path built out of CARGO_MANIFEST_DIR,
so dumping the autoloader failed wherever the build tree was gone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PluginManager::getPluginCapability hands the plugin itself to the
capability constructor. Only a PHP-implemented plugin had an entity the
child could receive, so a Rust-implemented one bailed out; it now crosses
as a handle to an R-table entity behind Shirabe\RustPluginStub, or its
Capable flavour, since `$plugin instanceof Capable` is what decides
whether Composer asks a plugin for capabilities at all.
This is what the two capability tests of PluginInstallerTest were waiting
on: the mocked Capable plugin is Rust-side, and one of them asserts the
identity of the plugin read back out of $capability->args.
|
|
PathDownloader builds an ArchivableFilesFinder and hands it to
Filesystem::mirror as the iterator that selects what to copy, so a path
package installed by mirroring drops what .gitattributes marks
export-ignore, what .gitignore excludes and the VCS directories. The
port dropped the argument, and mirrored the source tree whole.
Every method mirror() calls on the entries it walks is derived from the
pathname, so the iterator is modeled as a list of pathnames rather than
as a Traversable of SplFileInfo.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
doRemove() renames a directory to a random hidden name before emptying
it, and undoes that rename when the final rmdir fails, so a concurrent
process cannot recreate the path mid-removal. It also walks one level at
a time through FilesystemIterator instead of flattening the whole tree,
and lets an inner rmdir failure pass, both as upstream does.
copy() keeps the mode fopen($targetFile, 'w') would have left rather
than the origin's, symlink() and mirror() call readlink() and
getLinkTarget() where upstream does, and a directory iterator that
cannot be opened propagates its UnexpectedValueException instead of
being swallowed or flattened into an IOException.
Error message text is out of scope per docs/known-incompatibilities.md,
so the three TODO(phase-c) markers that only tracked wording are gone,
along with linkException()'s Windows-only branch. So are the arguments
no caller varies -- symlink()'s copyOnWindows, mirror()'s iterator and
options, copy()'s overwriteNewerFiles -- which removes the last
TODO(phase-c) in the file.
New shim functions: readlink, filesystem_iterator, stream_is_local,
strrev and SplFileInfo::getLinkTarget. base64_encode takes bytes so
random_bytes() can feed it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Every package it held now lives in its own crate, so the umbrella crate
has nothing left in it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-xdebug-handler crate
Move `Composer\XdebugHandler` out of shirabe-external-packages and into
its own crate, so the path is `shirabe_xdebug_handler::XdebugHandler`
instead of
`shirabe_external_packages::composer::xdebug_handler::XdebugHandler`.
Standing alone, the stub no longer sits in a crate that shirabe-php-rpc
depends on, so drop the dependency-cycle rationale from the comments that
explain why callers reach for shirabe_php_rpc directly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Move `Composer\CaBundle` out of shirabe-external-packages and into its
own crate, so the path is `shirabe_ca_bundle::CaBundle` instead of
`shirabe_external_packages::composer::ca_bundle::CaBundle`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Move `Seld\Signal` out of shirabe-external-packages and into its own
crate, so the path is `shirabe_seld_signal::SignalHandler` instead of
`shirabe_external_packages::seld::signal::SignalHandler`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-seld-json-lint crate
Move `Seld\JsonLint` out of shirabe-external-packages and into its own
crate, so the path is `shirabe_seld_json_lint::ParsingException` instead
of `shirabe_external_packages::seld::json_lint::ParsingException`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-symfony-console crate
Move `Symfony\Component\Console` out of shirabe-external-packages and
into its own crate, so the path is
`shirabe_symfony_console::application::Application` instead of
`shirabe_external_packages::symfony::console::application::Application`.
The `delegate_to_inner!` and `delegate_command_trait_impls_to_inner!`
macros move with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-symfony-finder crate
Move `Symfony\Component\Finder` out of shirabe-external-packages and into
its own crate, so the path is `shirabe_symfony_finder::Finder` instead of
`shirabe_external_packages::symfony::finder::Finder`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-symfony-filesystem crate
Move `Symfony\Component\Filesystem` out of shirabe-external-packages and
into its own crate, so the path is
`shirabe_symfony_filesystem::Filesystem` instead of
`shirabe_external_packages::symfony::filesystem::Filesystem`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe-symfony-process crate
Move `Symfony\Component\Process` out of shirabe-external-packages and
into its own crate, so the path is `shirabe_symfony_process::Process`
instead of `shirabe_external_packages::symfony::process::Process`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Move `Composer\Pcre` out of shirabe-external-packages and into its own
crate, so the path is `shirabe_pcre::preg::Preg` instead of
`shirabe_external_packages::composer::pcre::preg::Preg`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
LogLevel has no user outside BaseIO, so it lives next to its only
consumer and the psr crate tree is dropped. The log() level parameter
becomes &str now that the constants are compared directly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
These smoke tests only checked that `<cmd> --help` exited cleanly and
that running each command did not panic. The Composer-derived test
suite now covers the same commands with real assertions, so the smoke
tests no longer add anything.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The shim raises no PHP-level errors, so error_get_last() always returned
None and every message built from it lost its trailing reason. Now that
the fs mutators and php_strip_whitespace carry an io::Error, take the
reason from the call that actually failed instead of a global last-error
slot.
Filesystem::unlinkImplementation returns that error rather than a bool so
ensureDirectoryExists, unlink and rmdir can report it, and PhpFileParser
appends it to the "following message may be helpful" hint. The wording
is Rust's io::Error text, not PHP's warning text, for the same reason
noted in symfony/filesystem.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
mkdir, rmdir, unlink and symlink each had a bool version and a _result
twin returning the io::Error, which left two names for one call. Keep
only the Result form and let the callers that want a boolean spell out
.is_ok(). Call sites that discard the outcome, as their PHP originals
do, are unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
InstalledVersions is a runtime API for plugins and project code; Composer
itself never reads it. Its consumers run in the PHP worker against the copy
FilesystemRepository dumps to vendor/composer/InstalledVersions.php, whose
static state is already kept in sync by __shirabe_installed_versions_reload.
Nothing in Rust read the mirrored statics, so reload() and the reflection
setters were no-ops.
The tests covered only the Rust port, not the PHP class the worker loads, so
they assert nothing about compatibility; they are left as todo!() skeletons.
This also removes the shim functions method_exists, php_dir and
require_php_file, whose only caller was the deleted module.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Composer turns the cycle collector off around the dependency solver, but
Rust has no GC, so the gc_collect_cycles/gc_disable/gc_enable shims were
no-ops. Remove the call sites and the now-callerless shim functions.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The only live caller passed the constant 'array_merge', so the list
concatenation is written out in place, as ClassLoader::get_prefixes
already does. That leaves the shim function without callers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Problem reported the platform php version from the shim's compile-time
PHP_VERSION constant, and the shim's phpversion() hit todo!() for any
extension. Go through the RPC bridge instead, as PHP's
Composer\Platform\Runtime does, and drop the shim function that now has
no callers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
shirabe never runs on HHVM, so the HHVM_VERSION_ID branches are dead.
Dropping them leaves the shim's unimplemented `constant()` without a
caller, so remove it as well.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
The shim reported setExternalAttributesName as missing, so ZipArchiver took
the branch for libzip below 0.11.2 and every archived entry got the zip
crate's default mode. The attributes now travel as arguments to add_file and
add_empty_dir, because the crate fixes an entry's external attributes when
the entry is started and offers no way to amend one already written.
unix_permissions keeps only the low 9 mode bits, on top of which the crate
restores S_IFREG and S_IFDIR, so setuid/setgid/sticky bits and other file
types are still dropped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
The shim's PATH_SEPARATOR was hardcoded to ":", so every PATH list was
split and joined on the wrong character off Unix. std::env::split_paths
and join_paths use the platform's separator, which also lets the bin-dir
membership test in EventDispatcher compare list entries instead of
regex-matching the raw PATH string.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Concatenating a directory, MAIN_SEPARATOR and a component reimplements
what Path::join already does. Joining directly also drops the separator
from the intermediate values it used to be baked into, such as
ClassLoader's $pathEnd.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
MAIN_SEPARATOR is the path separator; PHP's `'\\' === DIRECTORY_SEPARATOR`
uses it as an OS test only because PHP has no dedicated one. cfg!(windows)
says what the branch actually selects on, and leaves MAIN_SEPARATOR to the
sites that really join or split paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The shim's DIRECTORY_SEPARATOR was hardcoded to "/", so every ported
`'\\' === DIRECTORY_SEPARATOR` check compared against a constant that
does not track the target platform. std::path::MAIN_SEPARATOR and
MAIN_SEPARATOR_STR carry the same meaning as PHP's constant and resolve
per platform, so the Windows branches are selected on Windows targets.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The deadline is a constant baked in at build time, so PHP's define() of
COMPOSER_DEV_WARNING_TIME cannot make Application take that branch.
Application now holds the deadline in a field that __set_dev_warning_time
overrides, letting testDevWarning run instead of staying ignored. The
define() shim, whose only caller was that test, goes away with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The port's fall-through stood in for PHP's `catch (\Exception $e)`, which
does not catch an `\Error`; a TypeError reaching JsonFile::read would come
back out as a `\RuntimeException` saying the file could not be read.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PharArchiver::archive catches only `\UnexpectedValueException` and wraps
it in a `\RuntimeException` naming the target and sources; anything else
leaves the method as it was thrown. The port wrapped every error, so the
two `\RuntimeException('Can not compress to %s format')` raised inside
the `try` came back out with a second message around them and their code
replaced. Reading the message and code off the caught exception rather
than off whatever arrived also drops the guesswork the old `map_or(0, ..)`
had to do.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Composer hands the exception it caught to the one it throws in its place,
so `getPrevious()` reaches the cause and Application's renderer prints the
whole chain. Every ported site dropped it, because the flat exception
structs had nowhere to put one. `AnyThrowable::into_previous` turns the
caught error into that argument, and the 13 sites now pass it.
`getCode()` came along for the ride at the four sites that derive the new
exception's code from the caught one (PharArchiver, ArrayLoader x2), and
ComposerRepository's message now names the caught exception's class
instead of the literal "Exception".
GitHubDriver::attemptCloneFallback took the previous exception's message
and appended it to its own, which no `\RuntimeException('Fallback to git
driver disabled')` in Composer ever says; it now chains it instead.
Git::syncMirror restores what PHP's `finally` does to an exception in
flight: the `git remote set-url` that scrubs credentials back out of the
URL runs in a `finally`, and when it fails PHP propagates *its* exception
over the one already leaving, chaining the displaced one as previous. The
port discarded the finally's result, so a failure to scrub the URL was
reported as a successful mirror sync. `AnyThrowable::set_previous`
models the engine-level chaining.
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>
|
|
Composer defines COMPOSER_DEV_WARNING_TIME from its phar stub when the
compiled version is a commit hash rather than a tag, so the value exists
only in the build artifact. It was a todo!() in the PHP shim, leaving the
warning branch in Application::do_run unreachable.
A build script now derives it the way Compiler does, from git describe
and the HEAD commit date, and composer::COMPOSER_DEV_WARNING_TIME holds
the result as a Rust constant instead of a runtime-defined one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Getting a rule's identity meant spl_object_hash(&*rule.borrow()), so the
solver borrowed a RefCell just to read an address, and a second function
spl_object_hash_process existed because one generic fn cannot tell Rc<T>
from &T.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PHP's version_compare takes its operator as a string, so the shim's port
did too, and Constraint carried two families of operator constants plus
translation tables to convert between the string form and its own int
codes. Five copies of those tables had accumulated across Constraint,
CompilingMatcher and the plugin value bridge.
version_compare now takes a CmpOp, which makes an invalid operator
unrepresentable and removes the tables' reason to exist. Constraint
stores a CmpOp and keeps only the string parsing its constructor needs;
getOperator, compile and CompilingMatcher::match speak CmpOp as well.
PHP's OP_* numbering stays observable: a plugin reads the raw integer off
the Constraint object over RPC, so get_operator_constant and its new
inverse hold that 0..5 mapping.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
InstallationManager left both PRE_PACKAGE_* and POST_PACKAGE_* as empty
stubs, so a subscriber never ran at all and the difference from upstream was
silent rather than an explicit error.
Operations cross the boundary as R-table entities with generated proxy
stubs. Materializing them the way a Link crosses is not possible: a
materialized value is revived by unserialize() on the child side, so its
properties never pass through the wire decoder and a nested handle
descriptor would not come back as a stub — and an operation always holds a
PackageInterface. execute() now shares one Rc per operation through the
whole batch pipeline, so a plugin sees one object for both the pre- and the
post-event of an operation, as it does in PHP.
POST_PACKAGE_* also moves out of the operation's promise chain into the
post-exec callback list PHP runs after waitOnPromises().
The stub generator materializes non-public class constants verbatim now,
which the operation classes need for their `protected const TYPE`: a
constant has no entity behind it, so a copy in the worker cannot diverge,
and keeping the declared visibility exposes nothing the real class hides.
The E2E fixture added here compares the recorded events against upstream
Composer. It also surfaced that upstream starts an operation's chain where
it is built (a null prepare() becomes an already-fulfilled React promise
whose handlers run through the immediately drained queue) while this port
only drives its futures in wait_on_promises, so the repository state a
pre-event observes differs; that half of the comparison is a separate
`#[ignore]`d test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
A proxy stub declares none of the real class's instance properties, and the
`__get`/`__set` forwarders were emitted only for classes that declare a public
one. Every other property access therefore got PHP's own answer for an
undeclared property — null on a read, a dynamic property on a write — so plugin
code reading state the entity holds ran on with null and failed somewhere else
entirely, or not at all.
Emit the forwarders on every root stub, add `__isset`/`__unset` alongside them
so `isset()` cannot answer false silently either, and serve all four from one
dispatcher that answers the state the Rust-side entity exposes and rejects every
other name.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|