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

<?php

 // 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/");
   closedir($bizarrevar);
   unset($bizarrevar);   
 } 
  
  
 $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' 
'--enable-track-vars'

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_INCLUDE   
MYSQL_LFLAGS   
MYSQL_LIBS   

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 
[EMAIL PROTECTED] :)

Thanks




-- 
Edit Bug report at: http://bugs.php.net/?id=9839&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
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