Bug #15942 [Opn->Fbk]: Problem with PEAR Validate

From: Date: Thu, 26 Feb 2009 08:35:08 +0000
Subject: Bug #15942 [Opn->Fbk]: Problem with PEAR Validate
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-75@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=15942&edit=1 ID: 15942 Updated by: amirsaied@gmail.com Reported By: hostmaster at soteros dot net Summary: Problem with PEAR Validate -Status: Open +Status: Feedback Type: Bug Package: Validate Operating System: Linux CentOS 5 Package Version: 0.8.2 PHP Version: 5.1.6 Roadmap Versions: New Comment: <div id="changeset"> <span class="removed">-Status: Open</span> <span class="added">+Status: Feedback</span> </div> You mean Validate returns true for an email address like "abc@defg" ? Here I'm getting false: amir@c3po ~ $ php -r 'require_once "Validate.php"; var_dump(Validate::email("abc@defg", array("use_rfc822" => true, "check_domain" => true)));' bool(false) Check your DNS service, if it's returning a web page as the result of an invalid domain name then you are in trouble (like what OpenDNS does). Such services makes almost every A type DNS record valid. Previous Comments: ------------------------------------------------------------------------ [2009-02-25 14:23:47] soteros <div id="changeset"> <span class="removed">-Package Version:</span> <span class="added">+Package Version: 0.8.2</span> </div> ------------------------------------------------------------------------ [2009-02-25 14:20:18] soteros Description: ------------ The 'check_domain' and 'use-rfc822' do not seem to function correctly. Test script: --------------- <?php require_once('Validate.php'); if (isset($_POST['btnValidateAddress']) && $_POST['address'] != '') { $address = $_POST['address']; if (!Validate::email($address, array('check_domain' => 'true','use_rfc822' => 'true'))) { echo('<p>Invalid address</p>'); } else { echo('<p>Valid address</p>'); } echo("<p><a href=\"".$_SERVER['PHP_SELF']."\">Restart</a></p>"); } ?> <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post"> <label>Enter an email address:</label> <input type="text" name="address" value="<?php echo(@$_POST['address']); ?>" /> <input type="submit" name="btnValidateAddress" value="Validate" /> </form> Expected result: ---------------- Email address that has no domain MX or A records and/or is not rfc822-compliant should NOT validate Actual result: -------------- ANY string of the format 'abc@defg' is returned as valid only strings of format 'abd@' are retunred as invalid ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=15942&edit=1

« previous php.pear.bugs (#75) next »