note 49737 added to function.checkdnsrr

From: Date: Mon, 07 Feb 2005 13:46:47 +0000
Subject: note 49737 added to function.checkdnsrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-84615@lists.php.net to get a copy of this message
Note to Patrick's regular expression (from 14-Dec-2004): Don't use it as it will not recognize every valid email address, because valid domain names do not pass the regex. For example: test--domain.com is a perfectly valid domain, but won't be recognized as such. If you have to use a regular expression as a first filter, then either use the complete complex form based on RFC2822, or stick to the most basic regex like this: ".+@.+\..+." Explanation: The username in front of the @ can include every known character in the world - it has to be escaped somehow, but dealing with this is a mess. The shortest possible domain name is 1 character long, not 2 or 3 (although many registries impose such arbitrary rules on domain names). Try www.x.org if you don't believe this. :) Only the top level domain consists of at least 2 characters (country code tld), but there should be no upper limit. Many had to learn the hard way as .info became available. And .museum. Maybe there will be .solarsystem someday. So the shortest possible email address consists of 6 characters: "a@b.cd". I do not use more specific character classes for the domain names because we have international domain names, which opens up the whole unicode range as valid characters. Converting these into useable dns domain names is a different task, best left to appropriate librarys such as PEAR's Net_IDNA. Rule of thumb: Don't assume too much. If a string doesn't contain an "@"-sign and a dot after that, then it surely is no email address, and no further checking needs to take place. Everything else should go one step further. ---- Manual Page -- http://www.php.net/manual/en/function.checkdnsrr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49737 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49737&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49737&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49737&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49737&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49737&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49737&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84615) next »