Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77347 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24997 invoked from network); 19 Sep 2014 17:51:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2014 17:51:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.54 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 209.85.218.54 mail-oi0-f54.google.com Received: from [209.85.218.54] ([209.85.218.54:63579] helo=mail-oi0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/F1-13213-C0D6C145 for ; Fri, 19 Sep 2014 13:51:08 -0400 Received: by mail-oi0-f54.google.com with SMTP id a3so1904003oib.13 for ; Fri, 19 Sep 2014 10:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=v8zVxW8PxAW8CtAM0cjOlxsefWMQBWjkOytkrUEnOTo=; b=lgxG+zzQjvy90/buqTvOfwkiuVnvuBgpbQHAfzntghMJalJJqB+nobUyUIVN8T4di4 fMFW0hfrmyOLz1AtrnWbsW2l0wfNzVMH4ySZ4ims0es++8HYW36Th/AGuO8TKbNMqeyi e8WPRlQ9vUfNUruvpGxKjCCZTDDJfKnG9vZBTh9vRHBmphCMrapjN7tomS3PML7BQgFO fcz+O6tJ/SmV5KbNamIkNEfeEZSXVV+BHxG8Ns4SjfrIlcayJh9ui8gUaIcgIE+AeuaG HHa5Br9l6n7s/K4roYwEOX8lac1Az8WXq4MxlIB8weKZ3jnDOECYwl7D5vB+TKpSxCMq RI6w== MIME-Version: 1.0 X-Received: by 10.60.103.13 with SMTP id fs13mr2980816oeb.48.1411149065754; Fri, 19 Sep 2014 10:51:05 -0700 (PDT) Received: by 10.202.227.206 with HTTP; Fri, 19 Sep 2014 10:51:05 -0700 (PDT) In-Reply-To: References: Date: Fri, 19 Sep 2014 10:51:05 -0700 Message-ID: To: Adam Harvey Cc: Chris Wright , PHP internals list Content-Type: multipart/alternative; boundary=089e0112c408ca417405036ebe82 Subject: Re: [PHP-DEV] Why does checkdnsrr() default to MX?? From: kris.craig@gmail.com (Kris Craig) --089e0112c408ca417405036ebe82 Content-Type: text/plain; charset=UTF-8 On Fri, Sep 19, 2014 at 10:24 AM, Adam Harvey wrote: > On 19 September 2014 02:58, Chris Wright wrote: > > On 18 September 2014 20:29, Kris Craig wrote: > >> Hey guys, > >> > >> I just spent some time troubleshooting what appeared to be a DNS issue > >> before I realized that, absent the optional $type argument, checkdnsrr() > >> defaults to "MX". Can anybody explain why it's defaulting to "MX" and > not > >> "ANY"? It seems really counter-intuitive. > > > > This is a big wtf, especially since getmxrr() exists. A cursory search > > of github (not the best measure I know, but easy) reveals only a few > > cases where this function is called without the second argument, and > > every case I've found looks like they were expecting an A record, so > > this code is likely broken anyway. > > > > In other words, +1 to change this to something saner ASAP. > > As an alternative, could we just make the type argument mandatory in > PHP 7 and start issuing E_DEPRECATED warnings if it's omitted in 5.6 > or 5.7? > > Adam > I like both ideas. Adam's approach would be more inconvenient for developers, but it would also be less of a BC issue since merely changing the default could cause some existing code to fail silently as opposed to generating an error. On the other hand, I can't think of any such use case in which checking all DNS entries instead of just MX would cause any scripts to break. The only possible scenario I can think of would be if they're using dnsrr() to check if an MX record exists and hit a host that has an A record but not MX. That would cause it to return TRUE when they're expecting FALSE. I'll draft an RFC when I get a chance and include both options in it. --Kris --089e0112c408ca417405036ebe82--