Skip to content

php-in-php: VmSockets::atmark — prefer libc sockatmark FFI, drop host socket_atmark() delegation (#6544 phase 2) #7998

Closed

Description

@PurHur

Category

php-in-php | runtime-shrink

Problem

#6544 landed socket_atmark() VM builtin, but VmSockets::atmark() still prefers host \socket_atmark() when function_exists, bypassing the libc sockatmark(3) FFI path. Self-host/AOT must not depend on Zend ext/sockets in the driver loop.

php-src reference

Scope (PHP-in-PHP)

Path Work
ext/sockets/VmSockets.php FFI-first sockatmark; host fallback only when FFI unavailable
ext/sockets/socket_atmark.php BuiltinExecute — validate socket arg before void return skip
Tests test/unit/VmSocketsRuntimeShrinkTest.php

0 C runtime lines — PHP + libc FFI only.

Done when

  • VmSockets::atmark does not call host \socket_atmark() when libc FFI is available
  • Unit test guards host-delegation regression
  • socket_atmark compliance PHPT still green when deps available

Related

#6544 #1492 #7287 #7915

Activity

  1. added
    enhancementNew feature or request
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 11, 2026
  2. PurHur commented on Jun 11, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run

  3. PurHur commented on Jun 11, 2026

    @PurHur
    OwnerAuthor

    Merged via #7999.

    Changes: VmSockets::atmark() FFI-first (sockatmark(3)); host \socket_atmark() only when FFI unavailable. socket_atmark builtin uses BuiltinExecute::writeReturn.

    Verification:

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter VmSocketsRuntimeShrinkTest'
    # OK (3 tests, 8 assertions)
    

    C runtime: 0 lines (PHP-only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions