Skip to content

fix(deps): drop unmaintained crates and patch anyhow and shlex - #4

Merged
loks0n merged 2 commits into
mainfrom
fix/unmaintained-crates
Nov 3, 2026
Merged

loks0n merged 2 commits into
mainfrom
fix/unmaintained-crates

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What

Clears every RustSec advisory in Cargo.lock. The unmaintained crates all came in through ext-php-rs 0.7.4, so the fix is to upgrade ext-php-rs to 0.16.4 and adapt the extension code.

Advisories and crates

ansi_term 0.12.1 (RUSTSEC-2021-0139, unmaintained): removed. It came from clap 2.34 via bindgen 0.59; bindgen 0.73 no longer depends on clap.

atty 0.2.14 (RUSTSEC-2024-0375 unmaintained, RUSTSEC-2021-0145 unaligned read): removed. It came from clap 2.34 and env_logger 0.9 via bindgen 0.59, and both are gone.

instant 0.1.12 (RUSTSEC-2024-0384, unmaintained): removed. It came from parking_lot 0.11; ext-php-rs 0.16 uses parking_lot 0.12 (parking_lot_core 0.9), which doesn't depend on it.

anyhow 1.0.58 (RUSTSEC-2026-0190, unsound Error::downcast_mut): bumped to 1.0.104.

shlex 1.1.0 (RUSTSEC-2024-0006): bumped to 2.0.1, which bindgen 0.73 requires.

cpufeatures 0.2.2 (yanked): bumped to 0.2.17.

Why 0.16.4 and not an earlier ext-php-rs

ext-php-rs 0.8 to 0.15 drop the crates above but add zip 0.6 to 8.x as a build dependency, which brings RUSTSEC-2026-0367/0368/0369/0429 (fixed only in zip >= 9) and, with 0.6, the zstd-safe 5 advisories. 0.16.4 is the first release on zip 9. cargo audit is now clean.

Code changes

Since 0.14, functions have to be registered explicitly with wrap_function! in #[php_module].

0.16 throws TypeError for arguments it can't convert, where 0.7 threw Exception. salt is now taken as a Zval and converted by hand, so a null or non-string salt still throws Exception (covered by testInvalidSalt). Bad values for the other arguments now throw TypeError.

Minimum PHP is now 8.1

ext-php-rs 0.16.4 still lists PHP 8.0 as supported, but its wrapper.c calls zend_destroy_static_vars, which only exists from PHP 8.1. Under zig (the Alpine build) that's a compile error; under gcc it builds a .so with an undefined symbol. No ext-php-rs release without the zip advisories builds on 8.0. PHP 8.0 has been EOL since November 2023, and nothing in the org loads this extension (docker-base builds the C DomBlack/php-scrypt extension), so the README now says PHP 8.1 or newer.

CI image fixes

The Tests workflow was already broken on main: php:8.0.18-cli is Debian bullseye, whose packages have moved to archive.debian.org, so apt-get install returns 404s, and the pinned zig nightly (0.10.0-dev.2674) has been deleted from ziglang.org. This PR:

  • moves the build and test images to php:8.5-cli and php:8.5-cli-alpine (the PHP version Appwrite runs)
  • installs the distro clang instead of clang-11
  • uses the zig 0.14.0 release (clang 19, matching trixie's libclang, so bindgen doesn't trip on zig's arm_neon.h) and cargo install cargo-zigbuild --locked
  • resolves the extension directory with php-config --extension-dir instead of hardcoding the PHP 8.0 API directory

Verification

cargo build, cargo fmt --check, cargo clippy --all-features -- -D warnings and cargo audit all pass locally. PHPUnit passes 4/4 against the extension built on the host (PHP 8.5, macOS), and 4/4 in both the tests_gnu and tests_alpine containers built with docker compose build (linux/arm64 locally; CI covers x86_64).

ansi_term, atty and instant came in through ext-php-rs 0.7.4 (bindgen 0.59 with clap 2 and env_logger 0.9, and parking_lot 0.11). ext-php-rs 0.16.4 drops all three and is the first release whose zip build dependency is past the zip extraction advisories that 0.8-0.15 pull in. Default features are disabled so the PHP 8.1 enum feature stays off and the extension still builds against PHP 8.0.

0.16 registers functions explicitly with wrap_function! and throws TypeError for arguments it cannot convert, so salt is now converted by hand to keep throwing Exception as before.
@ghost

ghost commented Nov 3, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Upgrades the Rust PHP extension bindings and dependency graph, adapts function registration and salt conversion, and raises the documented PHP minimum to 8.1. The test containers and workflow now build and run against PHP 8.5, using dynamically discovered extension directories for GNU and Alpine images.

Latest changes: The newest commits enable ext-php-rs default features, update the README minimum to PHP 8.1, and move the Docker and CI builds from PHP 8.0 to PHP 8.5 with refreshed Zig tooling and extension paths.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 6
File Change
.github/workflows/tests.yml Updates the CI image pulls to PHP 8.5 for GNU and Alpine test runs.
Cargo.toml Uses the default ext-php-rs 0.16.4 features.
Cargo.lock Refreshes the Rust dependency graph for ext-php-rs 0.16.4 and its updated dependencies.
Dockerfile Builds and tests on PHP 8.5, updates Zig/cargo-zigbuild, and installs the extension using each image's configured extension directory.
README.md Raises the documented minimum PHP version to 8.1.
src/lib.rs Adapts scrypt argument conversion and explicitly registers the function with the module.

Reviewed the commits since a753cd7 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

Comment thread Cargo.toml Resolved
ext-php-rs 0.16.4 calls zend_destroy_static_vars, which only exists from PHP 8.1, so the PHP 8.0 build fails under zig and leaves an undefined symbol under gcc. PHP 8.0 has been EOL since 2023 and its bullseye images can no longer install packages from security.debian.org, so the Tests workflow was already broken on main.

Move the test images to PHP 8.5, install the distro clang, replace the deleted zig nightly with zig 0.14.0 (clang 19, matching trixie's libclang), resolve the extension directory with php-config, and restore ext-php-rs default features now that 8.1 is the floor.
@loks0n
loks0n merged commit 5bc486b into main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants