Skip to content

Stdlib: posix_initgroups() — initgroups(3) supplementary groups missing (ext/posix/posix.c) #19476

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Zend ext/posix exposes posix_initgroups(string $username, int $group_id): bool. This compiler lacks it (function_exists → false). Last remaining common posix gap after getpgrp (with #6504/#6489 landed).

Repro Zend 8.2+ VM (2026-07-16)
function_exists('posix_initgroups') true false

php-src reference

PHP implementation target

  • Thin libc ABI initgroups in PosixLibcThinAbi (write syscall — unavoidable; document in PR)
  • ext/posix/posix_initgroups.php + VM wrapper; string username via VmString::coerceStringBuiltinArg
  • Prefer not growing runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(function_exists(\"posix_initgroups\")); echo PHP_EOL;"
'

Done when

  • Function registered; arg TypeErrors match Zend (enum → TypeError)
  • Successful call as root matches Zend bool; failure sets posix_get_last_error
  • Compliance smoke .phpt
  • php-src-strict

Links

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-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions