PHP 4.0 Bug #5439: Arrays return varying/incomplete values
| From: | hunter at greenscarab dot org | Date: | Fri, 07 Jul 2000 16:34:50 +0000 |
| Subject: | PHP 4.0 Bug #5439: Arrays return varying/incomplete values | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23729@lists.php.net to get a copy of this message | ||
From: hunter@greenscarab.org
Operating system: Redhat Linux 2.2.14-5.0 i686
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: Arrays return varying/incomplete values
Code:
---
$already_found = array("NULL");
while ($spider_row = sybase_fetch_array($spider_result)) {
$gp_result = sybase_query("SELECT * from SY01200 WHERE INET2 LIKE '%" .
$spider_row["domain"] . "%'",$gp_db);
if ($gp_result) {
$gp_row = sybase_fetch_array($gp_result);
if (! in_array($gp_row["Master_ID"],$already_found)) {
$rowsum++;
echo "<tr>\n";
echo "<td><font face=\"Verdana\" size=-1>";
echo $gp_row["Master_ID"];
echo "</font></td>\n";
echo "<td><font face=\"Verdana\"
size=-1>REVENUE</font></td>\n";
echo "<td><font face=\"Verdana\"
size=-1>LOCATION</font></td>\n";
echo "</tr>\n";
}
if (! in_array($gp_row["Master_ID"],$already_found))
array_push($already_found,$gp_row["Master_ID"]);
sybase_free_result($gp_result);
}
}
sybase_free_result($spider_result);
sybase_close($gp_db);
---
The Master_ID column in the database has values such as "CUS0001" and "VEN0001"
depending on the domain ($spider_row["domain"]). The array $already_found should include a
list of the Master_ID values already listed to avoid duplicate entries. Instead, it returns all
sorts of values into the array .. Here is an example of the results of two identical searches:
Search 1:
Name Revenue Location
3DC0002 REVENUE LOCATION
USO0001 REVENUE LOCATION
USO0001 REVENUE LOCATION
Search 2:
Name Revenue Location
3DC0002 REVENUE LOCATION
USO0001 REVENUE LOCATION
The results obviously show screwy values in the array.
System info:
Apache/1.3.12 (UNIX) (Red Hat/Linux) PHP/4.01pl2 mod_perl/1.21
Intel Celeron 500 w/ 64MB RAM
Configure string: ./configure --with-apxs --with-sybase=/opt/sybase-11.9.2