Bug #1860: fopen/fclose cannot be called before making a mysql query
| From: | aljs at rapidnet dot net dot au | Date: | Sat, 24 Jul 1999 06:10:05 +0000 |
| Subject: | Bug #1860: fopen/fclose cannot be called before making a mysql query | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9087@lists.php.net to get a copy of this message | ||
From: aljs@rapidnet.net.au
Operating system: FreeBSD, Linux RedHat
PHP version: 3.0.11
PHP Bug Type: MySQL related
Bug description: fopen/fclose cannot be called before making a mysql query
This bug occurs in PHP 3.0.6, 3.0.7 and 3.0.11
Calling fopen, then flcose, then trying to create a link to a mysql query confuses mysql. It thinks
the file handle created in fopen is not closed. To illustrate this as simply as possible, I have
created the following examples:
I have put an example of the bug at: http://proxy.rapidnet.net.au/esol/mysql_bug.php3
The php that causes this bug can be viewed at http://proxy.rapidnet.net.au/esol/mysql_bug.txt
Proof that this is the bug can be found by viewing http://proxy.rapidnet.net.au/esol/mysql_bug_ok.php3
Source of the proof can be found at http://proxy.rapidnet.net.au/esol/mysql_bug_ok.txt
There is a partial workaround. That is to make file calls after opening the connection to mysql.
However, this workaround fails when trying to upload a file via php. In that case, the file handle
is established before any php code is executed. This confuses mysql as before whether fopen/fclose
is called or not.