php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16665 Multiple MySQL connections causes crash when result is passed thru a function
Submitted: 2002-04-17 13:37 UTC Modified: 2002-08-24 04:28 UTC
From: lance_rushing at hotmail dot com Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.1.2 OS: Win 32 (XP home)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
43 - 16 = ?
Subscribe to this entry?

 
 [2002-04-17 13:37 UTC] lance_rushing at hotmail dot com
I have a little bit of code for db connecting

If I call this function more than once in the script (e.i. to connect to a 2nd database) php prompts Apache to send an error report using M$ bugreporting in XP.

The code crases using either mysql_pconnect or mysql_connect

//Crashes
function db_hostconnect($host, $db_user, $db_pass) {
  $dbh = mysql_pconnect($host, $db_user, $db_pass);
  // some code 
  return $dbh;
}

//still crashes
function db_hostconnect($host, $db_user, $db_pass) {
  $dbh = mysql_pconnect($host, $db_user, $db_pass);
  return $dbh;
}

//works
function db_hostconnect($host, $db_user, $db_pass) {
  return mysql_pconnect($host, $db_user, $db_pass);
}

It appears to be something with moving the database handle into a variable and then returning the variable.

Thanks.






When running a script that has more than one mysql_connect prompts apache to send an error report (using M$ bug report feature in XP).

Commenting out one of the connections takes care of the problem.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-17 13:40 UTC] lance_rushing at hotmail dot com
Oops, forgot to say:

If I call the db_hostconnect more than once, then it causes the crash (about 80% of the time).  If I call the function once it works fine.
 [2002-07-07 22:09 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


And if 4.2.1 doesn't work either, please add a complete,
short and self-containing script which causes the crash.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC