PHP Classes

Infinite For Loop in ValidateEmailBox > GetLine Function

Recommend this page to a friend!

      PHP Email validation  >  All threads  >  Infinite For Loop in...  >  (Un) Subscribe thread alerts  
Subject:Infinite For Loop in...
Summary:Infinite Loop in ValidateEmailBox for
Author:Maureen M
Date:2017-11-18 15:22:58


  1. Infinite For Loop in...   Reply   Report abuse  
Picture of Maureen M Maureen M - 2017-11-18 15:22:58

Validating email box for email is causing infinite for loop in ValidateEmailBox > GetLine Function. Please let me know once the issue is fixed. Thanks

Mahantesh Patil

  2. Re: Infinite For Loop in...   Reply   Report abuse  
Picture of Ian Ian - 2017-12-28 14:38:00 - In reply to message 1 from Maureen M
It's not an infinite loop. It's caused by the script timing out while fgets is waiting for a response (and isn't sending one).

Using fread in function GetLine in email_validation.php solves the problem *provided* the timeout is also set low enough (there are multiple calls to this function via VerifyResultLines so they can add up).

I'm getting satisfactory results with:

$validator->timeout=5; (in test_email_validation.php)

and the following replacement function (in email_validation.php):

Function GetLine($connection)
$data=fread($connection,100); // because fgets does not respect socket_set_timeout
if($this->debug) $this->OutputDebug("S $line");