Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Bug #6914 Validates wrongly formatted IP
Submitted: 2006-02-24 03:20 UTC
From: manantha at gmail dot com Assigned: mj
Status: Closed Package: Net_CheckIP (version 1.2.0)
PHP Version: 4.4.0 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-02-24 03:20 UTC] manantha at gmail dot com (Manoj)
Description: ------------ if (Net_CheckIP::check_ip("226e+0.33.22.1")) { echo "ok"; } this returns "ok". but writing this addr into a postgresql database inet field returns an error. Instead of doing a is_numeric check on each octet, it will be better to do a is_int or a regex /^[0-9]+$/ or check the ip with this regx /^(\d+\.){3}\d+$/ Test script: --------------- <?php require_once "Net/CheckIP.php"; if (Net_CheckIP::check_ip("226e+0.33.22.1")) { echo "ok"; } else { echo "no"; } ?>

Comments

 [2006-12-15 17:42 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-12-15 17:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!