Skip to content

Regression: getservbyname/getservbyport/getprotobyname/getprotobynumber Reflection missing |false returns (ext/standard/basic_functions.stub.php) #26318

Description

@PurHur

Category

bug · php-src-strict · Reflection / stubs

Problem

Network service/protocol name lookup builtins exist and accept Zend named args, but Reflection return types drop |false. Zend stubs advertise int|false / string|false for lookup failure. Probed 2026-08-01 vs host Zend 8.2.32 / php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-01)
getservbyname return int|false int
getservbyport return string|false string
getprotobyname return int|false int
getprotobynumber return string|false string
named getservbyname(service:, protocol:) ok ok (names ok)

php-src reference

PHP implementation target

  • Builtin / Internal Reflection metadata in ext/standard (or network helpers) — advertise |false return unions matching stubs
  • PHP-in-PHP only; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php -r '\''
foreach (["getservbyname","getservbyport","getprotobyname","getprotobynumber"] as $f) {
  echo $f, " ret=", (string)(new ReflectionFunction($f))->getReturnType(), "\n";
}
'\''
php bin/vm.php -r '\''
foreach (["getservbyname","getservbyport","getprotobyname","getprotobynumber"] as $f) {
  echo $f, " ret=", (string)(new ReflectionFunction($f))->getReturnType(), "\n";
}
'\'''

Done when

  • Reflection returns match Zend (int|false / string|false) for all four
  • Compliance .phpt + test/repro/issue_NNNN_network_svc_ret.php
  • php-src-strict; no php-compiler-strict shortcut

Maintainer gate note (2026-08-01)

Pillar 1: user_release_ready: yes — inventory OK 6658/6658; north-star5-fast ok; gen-0 seed stale (46d).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-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