Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130861 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id CE0821A00BC for ; Wed, 13 May 2026 09:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1778665731; bh=9SP53vXt/1n4CyRsiPOx4njS+qxdbb9RG9/hbFjpVOc=; h=From:Subject:Date:References:To:In-Reply-To:From; b=NWPeGKnwpUIYPSoMhz1ZCeTR/k6FtzoI/oJqZOaUed4Al3k6vZqtO5UrZPjEIdhhh +7aNYaZ3t/ZZ/dhSP6pg2Ok1CkXNX2cWaRAI+uYPR4BxR1wHH/CccpVghEmYElFwaI 9f1Peob7yONnvs13nhIFyrUO8cJw2oJvGJD5S/WF3rSs3+v31dcTMabdij5rWzrmuV uThk7aKEi5I6JXmerFcf72W23rCmQaJ3kuRHy3xhg96Vk6cMq0JUFDlb4iy2TxJrIE hGE+cBdr7PW3/mSB6BohoKwxdvIwfPwHEmX4+kjzKe5qgMW8KTGDgrn/0OSkZaZLhp 421Ujin9jyE3g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4204D180032 for ; Wed, 13 May 2026 09:48:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.gna.ch (darkcity.gna.ch [84.234.28.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 13 May 2026 09:48:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.gna.ch (Postfix) with ESMTP id 469F623800EE for ; Wed, 13 May 2026 11:48:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1778665709; bh=9SP53vXt/1n4CyRsiPOx4njS+qxdbb9RG9/hbFjpVOc=; h=From:Subject:Date:References:To:In-Reply-To; b=mq5fYfYdcxb5Yf2/wxTg2OgQZwLQyW/bS+jdrjc2ph4HJzngwbbUanTv32LqkidcZ MAdi9QHaO/1kJs2tqM1AET9HjVNIATwWgqKlJu9StuVNuBnUZzxTOvEowV8TKTovY2 IhPKTI07dbPzgNv4SoxWpHcYyRGillDF6EE6BSb8= X-Virus-Scanned: amavis at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (mail.gna.ch [127.0.0.1]) (amavis, port 10024) with ESMTP id DXbthCzUlPsB for ; Wed, 13 May 2026 11:48:28 +0200 (CEST) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2e2d:4d00:dec:d13d:e60c:3296]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.gna.ch (Postfix) with ESMTPSA id E39A623800E3 for ; Wed, 13 May 2026 11:48:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1778665708; bh=9SP53vXt/1n4CyRsiPOx4njS+qxdbb9RG9/hbFjpVOc=; h=From:Subject:Date:References:To:In-Reply-To; b=BwyD33dZ8edxc0pO4IcBeVMWA3uDXT60NZZXU5OYTylGaRAsts8myomVpYY75CdhT 25Mw7nJdRAThS+Jr5gQTxi65y6+lPf/S89ZpQHnf7KPdzHKnGbUE+qiJqEgBkYk0G6 nfwQjmgSQGSG8yIaJEuiJ29LfcvJXIwmb0Z2BA7w= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PHP-DEV] Pre-RFC discussion about adding a DNS function for Null MX handling Date: Wed, 13 May 2026 11:48:28 +0200 References: To: internals@lists.php.net In-Reply-To: Message-ID: <9957BCCA-10E7-45BD-ABA8-B504DD14F60E@cschneid.com> X-Mailer: Apple Mail (2.3864.600.51.1.1) From: cschneid@cschneid.com (Christian Schneider) Am 13.05.2026 um 03:47 schrieb Samuel Fontebasso : > I would like to gather feedback before drafting an RFC for a small = addition to PHP's DNS functions: >=20 > dns_check_mx(string $hostname): bool >=20 > The function would check whether a hostname has at least one non-null = MX record. >=20 > Proposed behavior: > - false when there are no MX records; > - false when all MX records are Null MX records; > - true when at least one MX record has an exchange target other than = ".". Am I correct that this would be equivalent to the following (example.com = return empty string "" for MX, not a dot ".")? array_any( dns_get_record($hostname, DNS_MX), fn($r) =3D> $r["target"] ) I'm torn between providing in-core helper functions for common problems = (and getmxrr/dns_get_mx is indeed misleading/annoying with its bool = return value) but on the other hand I'm not sure checking for an MX is = something usually done by the general developer. This sounds more like = part of a library/framework as there are further complications when = trying to determine about the ability to send email to an address. Because of this I'd probably not add another helper function and try to = handle it on the documentation level instead. Regards, - Chris