php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5439 Arrays return varying/incomplete values
Submitted: 2000-07-07 18:34 UTC Modified: 2000-07-24 23:39 UTC
From: hunter at greenscarab dot org Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 4.0.1pl2 OS: Redhat Linux 2.2.14-5.0 i686
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hunter at greenscarab dot org
New email:
PHP Version: OS:

 

 [2000-07-07 18:34 UTC] hunter at greenscarab dot org
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-08 10:11 UTC] stas at cvs dot php dot net
Could you please provide a reproducible example, without using DB queries?
 [2000-07-08 16:30 UTC] hunter at greenscarab dot org
Perhaps the problem is related to the sybase calls rather than the array code. I attempted to reproduce the errors using no sybase functions to no avail. I can't seem to isolate which one is behaving since they depend on eachother.
 [2000-07-11 11:20 UTC] joey at cvs dot php dot net
Sybase db-lib is buggy. There is work underway to fix
this, but in the meantime, you can use the sybase CT-Lib,
which works fine.
 [2000-07-11 11:22 UTC] joey at cvs dot php dot net
Suspending until DB-Lib is fixed.
 [2000-07-24 23:39 UTC] joey@php.net
Please try latest CVS, or 4.0.2 (whenever it comes out) and
open a new bug if you still have problems.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC