ID: 9839 Updated by: sniper Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Analyzed Old-Bug Type: Directory function related Bug Type: MySQL related Assigned To: Comments: This is a bug in MySQL extension. The mysql_fetch_assoc() function is supposed to take only one argument. And you found this bug by passing the $dblink variable which holds (after running opendir) number 2 as value. The actual bug is in php_mysql_fetch_hash() function (in php_mysql.c) as there should be a check for the second possible argument, that it's one of MYSQL_ASSOC, MYSQL_NUM or MYSQL_BOTH. --Jani Previous Comments: --------------------------------------------------------------------------- [2001-03-19 11:16:29] [EMAIL PROTECTED] <?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 --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9839&edit=2 -- 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]