php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1860 fopen/fclose cannot be called before making a mysql query
Submitted: 1999-07-24 02:10 UTC Modified: 1999-07-24 02:18 UTC
From: aljs at rapidnet dot net dot au Assigned:
Status: Closed Package: MySQL related
PHP Version: 3.0.11 OS: FreeBSD, Linux RedHat
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aljs at rapidnet dot net dot au
New email:
PHP Version: OS:

 

 [1999-07-24 02:10 UTC] aljs at rapidnet dot net dot au
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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-24 02:18 UTC] rasmus at cvs dot php dot net
There is no bug there.  You can only use the return value of
a mysql_connect() call as a connection identifier.  You are
trying to use the return value of a mysql_select_db() call.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 07:01:26 2025 UTC