php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15186 define/mysql_connect problem
Submitted: 2002-01-23 15:20 UTC Modified: 2002-09-13 06:27 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: derek at bluegenesis dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.0-dev OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: derek at bluegenesis dot com
New email:
PHP Version: OS:

 

 [2002-01-23 15:20 UTC] derek at bluegenesis dot com
Previous to version 4.1.1, using define() to define a handle to a MySQL connection worked fine:

define(DB, mysql_connect(host,user,pass));

In PHP 4.1.1, if the above is done, then the script will hang for a long time (for a minute or so) if other mysql connections are attempted to be made.

i.e.:

function hang_mysql()
{
  define(DB1, mysql_connect(host,user,pass));
  define(DB2, mysql_connect(host,user,pass));
}

function doesnt_hang()
{
  $db1 = mysql_connect(host,user,pass);
  $db2 = mysql_connect(host,user,pass);
}

This wasn't a problem in PHP 4.0.6 and older versions.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-25 00:22 UTC] yuw at NO_SPAM dot msj dot biglobe dot ne dot jp
The same probrem occur with PostgreSQL.

This script will hang.

<?php
  define ("DBCONN01",pg_connect("dbname=db01 user=username"));
  define ("DBCONN02",pg_connect("dbname=db02 user=username"));
  pg_exec(DBCONN01,"select * from hogehoge");
  pg_exec(DBCONN02,"select * from fugafuga");
?>

RedhatLinux6.2(en) + php4.1.1 + PostgreSQL7.1.3
 [2002-01-25 01:01 UTC] yohgaki@php.net
deifne() works like a macro somewhat is 4.0.6.
It segfaults with 4.1.x and 4.2.0.

This is a scripting engine problem.
 [2002-01-25 06:09 UTC] yohgaki@php.net
For now, do not make resource constant. PHP tries to delete the value twice and segfaults, if type is resource.
 [2002-09-13 06:27 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC