From:             [EMAIL PROTECTED]
Operating system: Linux 6.2 on Alpha
PHP version:      4.0.4pl1
PHP Bug Type:     Directory function related
Bug description:  opendir() before mysql_fetch_assoc() returns non-associative array


 // If the opendir call is before the connect, an associative array            
 // is NOT returned from mysql_fetch_assoc() - the closedir does not 
 // seem to have any effect on this phenomena.    
 // It does NOT matter if the code is contained within the if() or
 // not. If the opendir() call occurs before the mysql_connect()
 // call, I get a farkled array from mysql_fetch_assoc().
 // Changing the database and/or tables queried does not seem to
 // make a difference to the bug.
 // Change the 0 to 1 below to see this bug
 if (1) {
   $bizarrevar = opendir("/etc/");
 $dblink = mysql_connect("localhost","user","password");
 mysql_select_db("dbname", $dblink);
 $qresult = mysql_query("SELECT * FROM comment", $dblink);
 while ($rx = mysql_fetch_assoc($qresult, $dblink)) {
    while (list($k,$v) = each($rx)) {
       print(" $k = $v<BR>\n");

------------- End Script ------------

Data from phpinfo():

PHP was copmpiled with './configure' '--with-mysql' '--with-apache=../apache' 

Virtual dir support is disabled

Apache Info: 

Apache Version Apache/1.3.19 
Apache Release 10319100 
Apache API Version 19990320 
Loaded Modules mod_php4, mod_setenvif, mod_auth, mod_access, mod_alias, mod_userdir, 
mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, 
mod_status, mod_negotiation, mod_mime, mod_log_config, mod_env, http_core 

MySQL Info:

Active Persistent Links 0 
Active Links 0 
Client API version 3.23.22-beta 

mysql.allow_persistent  On On 
mysql.default_host  no value no value 
mysql.default_password  no value no value 
mysql.default_port  no value no value 
mysql.default_socket  no value no value 
mysql.default_user  no value no value 
mysql.max_links  Unlimited Unlimited 
mysql.max_persistent  Unlimited Unlimited 

If you need additional information, please feel free to contact me via email at 


Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to