Skip to content

Stdlib: gethostbyname() / dns_get_record() / checkdnsrr() — DNS lookups (ext/standard/dns.c parity) #3258

Description

@PurHur

Category

stdlib | spec refresh (2026-06-17)

Problem

Registration gap closed: gethostbyname(), gethostbyaddr(), dns_get_record(), checkdnsrr(), and dns_check_record() are registered in ext/standard/Module.php and return data on VM (audit 2026-06-17).

Remaining php-src-strict parity (file sub-issues or checklist items here):

Gap Tracker
dns_get_record() TTL field always 0 #9307
JIT/AOT lowering missing or host-FFI only implement after VM guards green
DNS_* constant edge values vs php-src verify ext/standard/VmConstants.php
Resolver failure shapes (false + warnings) match ext/standard/dns.c
Offline CI @requires network document skip policy

This issue stays the umbrella for DNS family completeness; workers should claim #9307 or add focused repro issues rather than re-implementing registration.

php-src reference

Repro (registration — GREEN)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
foreach ([\"gethostbyname\",\"dns_get_record\",\"checkdnsrr\",\"gethostbyaddr\"] as \$f)
  echo \$f,\": \", function_exists(\$f)?\"yes\":\"no\", PHP_EOL;
"'
# 2026-06-17: all yes

Repro (behavior — compare Zend)

<?php
echo gethostbyname('localhost'), "\n";
$r = dns_get_record('example.com', DNS_A);
var_export(is_array($r));
if (is_array($r) && isset($r[0]['ttl'])) {
    echo "\nttl=", $r[0]['ttl'], "\n";
}
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
php repro.php
Check Zend VM (audit)
gethostbyname('localhost') 127.0.0.1 / ::1 127.0.0.1
dns_get_record(..., DNS_A) array yes yes
ttl field resolver TTL 0 (#9307)

Scope

Module Path
VM ext/standard/gethostbyname.php, gethostbyaddr.php, dns_get_record.php, checkdnsrr.php
Constants ext/standard/VmConstants.php
JIT/AOT host resolver wrappers after VM parity
Tests test/compliance/cases/stdlib/gethostbyname.phpt, dns_get_record*.phpt

Done when

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter gethostbyname'
php script/capability-matrix.php

Related

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions