Description
The PHP.wasm DNS polyfill added after #1042 defines dns_check_record(), dns_get_record(), and dns_get_mx(), but all three still return hardcoded failure/empty results and emit warnings. In the Node runtime this is a behavioral incompatibility rather than an unavailable capability: packages/php-wasm/node/src/lib/wasm-user-space.ts already bridges Node DNS for gethostbyname().
This prevents WordPress and plugin code from detecting real A/MX records. Downstream examples include email validation, hosting-provider detection, site profiling, security scanning, and HTTP tests.
Reproduction
Run PHP 8.4 through the Node PHP.wasm runtime:
var_dump(dns_check_record('wordpress.org', 'A'));
var_dump(dns_get_record('wordpress.org', DNS_A));
var_dump(dns_get_mx('wordpress.org', $hosts, $weights), $hosts, $weights);
Observed:
bool(false)
array(0) {}
bool(false)
The implementation explicitly emits:
dns_check_record() always returns false in PHP.wasm.
dns_get_record() always returns an empty array in PHP.wasm.
dns_get_mx() always returns an empty array in PHP.wasm.
Source: packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c.
Expected behavior
In the Node runtime, resolve requested DNS records through Node's DNS APIs and return PHP-compatible result shapes for at least A, AAAA, CNAME, MX, NS, TXT, SRV, CAA, and PTR records. Preserve deterministic false/empty behavior when resolution fails. Browser behavior can remain explicitly unsupported until it has a resolver transport.
Add Node integration coverage asserting real record shapes and aliases (checkdnsrr, getmxrr) rather than only function existence.
Description
The PHP.wasm DNS polyfill added after #1042 defines
dns_check_record(),dns_get_record(), anddns_get_mx(), but all three still return hardcoded failure/empty results and emit warnings. In the Node runtime this is a behavioral incompatibility rather than an unavailable capability:packages/php-wasm/node/src/lib/wasm-user-space.tsalready bridges Node DNS forgethostbyname().This prevents WordPress and plugin code from detecting real A/MX records. Downstream examples include email validation, hosting-provider detection, site profiling, security scanning, and HTTP tests.
Reproduction
Run PHP 8.4 through the Node PHP.wasm runtime:
Observed:
The implementation explicitly emits:
dns_check_record() always returns false in PHP.wasm.dns_get_record() always returns an empty array in PHP.wasm.dns_get_mx() always returns an empty array in PHP.wasm.Source:
packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c.Expected behavior
In the Node runtime, resolve requested DNS records through Node's DNS APIs and return PHP-compatible result shapes for at least A, AAAA, CNAME, MX, NS, TXT, SRV, CAA, and PTR records. Preserve deterministic false/empty behavior when resolution fails. Browser behavior can remain explicitly unsupported until it has a resolver transport.
Add Node integration coverage asserting real record shapes and aliases (
checkdnsrr,getmxrr) rather than only function existence.