FredGarcia / rolling-curl

Automatically exported from code.google.com/p/rolling-curl
0 stars 0 forks source link

The same conditional is being checked twice inthe same statement in function rolling_curl(...) - sizeof()/count() #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

There seems to be an erroneous (duplicated) check on the same conditional value 
in "function rolling_curl(...)" in the RollingCurl class.

// start a new request (it's important to do this before removing the old one)
if ($i < sizeof($this->requests) && isset($this->requests[$i]) && $i < 
count($this->requests)) {...}

$i < sizeof($this->requests)

and...

$i < count($this->requests)

are aliases of each other, and therefore will track each other with identical 
values (they are the same variables, only using alias names)

q.v. http://php.net/manual/en/function.sizeof.php
In PHP, sizeof() is just an alias for the true function, which is count()

REQUEST:
If this is indeed considered erroneous;

please remove "$i < sizeof($this->requests)" from the above mentioned 
conditional statement in function rolling_curl

Additionally renaming each sizeof(..) to count(...) would make the code a 
little more semantic when reading it.

Many Thanks,

Mark S.

Original issue reported on code.google.com by netbobs...@gmail.com on 26 Oct 2010 at 11:43