Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.2

Bug #3993 parameter new_link isn't a valid parameter for mysql_pconnect
Submitted: 2005-03-29 13:11 UTC
From: yoghoyogho at fastmail dot fm Assigned: danielc
Status: Closed Package: DB
PHP Version: Irrelevant OS: Linux FreeBSD
Roadmaps: (Not assigned)    

 [2005-03-29 13:11 UTC] yoghoyogho at fastmail dot fm
Description: ------------ in lines 216-222 in mysql.php it says: ------------------------------------------ if (isset($dsn['new_link']) && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true)) { $params[] = true; } else { $params[] = false; } ------------------------------------------ The new_link parameter became available in PHP 4.2.0 for mysql_connect. But it isn't a parameter that is available for mysql_pconnect. I suggest this code fix: ------------------------------------------ if (!$persistent && version_compare(phpversion(), $this->features['new_link'], '>=')) { if (isset($dsn['new_link']) && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true)) { $params[] = true; } else { $params[] = false; } } ------------------------------------------ For reference compare with and search for new_link


 [2005-03-29 13:22 UTC] danielc
Yep, it became available in 4.2.0. And 4.2.0 is an explicit dependency for the DB package and the minimum supported by PEAR in general.
 [2005-03-29 13:23 UTC] danielc
Hmm... Now, I see you're talking about pconnect. Sorry about that... Let me examine.
 [2005-03-29 13:30 UTC] danielc
Fixed in CVS and will be in a new release (1.7.5) in a few minutes. Thanks.
 [2005-03-29 14:53 UTC] yoghoyogho at fastmail dot fm
Thanks for your quick response, danielc. Unfortunately, the fix you've added in the CVS doesn't resolve this bug. The way it's coded now, there will be a parameter added to $params, regardless of it's value (either true or false). What I was argumenting for was that this parameter shouldn't be added if mysql_pconnect is used. So AROUND the if-branch should be a check that ensures that mysql_connect is used. My suggestion is to remove !$persistent from the inner if-branch and make it an outer if-branch like so: if (!$persistent) { if (isset($dsn['new_link']) && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true)) { $params[] = true; } else { $params[] = false; } } This way the parameter doesn't end up in mysql_pconnect, thus shifting the value of client_flags out of reach. I also added the version_compare because in the $features array (in line 76) the item 'new_link'=>'4.2.0' was available. So if that value is there, why not use it? :-) So that's were my first code fix suggestion came from.
 [2005-03-29 15:01 UTC] danielc
Crap. You're right. I wasn't paying attention. I'll fix it.
 [2005-03-29 15:26 UTC] yoghoyogho at fastmail dot fm
thanks danielc