From:             
Operating system: 
PHP version:      Irrelevant
Package:          MySQLi related
Bug Type:         Bug
Bug description:MySQLi doesn't always reuse persistent link inside same script

Description:
------------
If I open an existing persistent link a second (or 3rd, ...) time inside
the same script, MySQLi is only reusing the existent link if I have
explicitly closed the link before. At the moment it's always creating a new
link.



With MySQL it's working as expected.



 

Test script:
---------------
<?php

$con1 = mysqli_connect('p:localhost', 'foo', '');

var_dump($con1->thread_id);

$con2 = mysqli_connect('p:localhost', 'foo', '');

var_dump($con2->thread_id);

mysqli_close($con1);

mysqli_close($con2);



echo "---\n";



$con3 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con3->thread_id);

mysqli_close($con3);

$con4 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con4->thread_id);

mysqli_close($con4);



echo "===\n";



$con5 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con5));

$con6 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con6));

mysql_close($con5);

mysql_close($con6);



echo "---\n";



$con7 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con7));

mysql_close($con7);

$con8 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con8));

mysql_close($con8);



?>



Expected result:
----------------
int(1)

int(1)

---

int(2)

int(2)

===

int(3)

int(3)

---

int(4)

int(4)

Actual result:
--------------
int(1)

int(2)

---

int(3)

int(3)

===

int(4)

int(4)

---

int(5)

int(5)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54181&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54181&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54181&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54181&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54181&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54181&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54181&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54181&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54181&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54181&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54181&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54181&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54181&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54181&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54181&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54181&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54181&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54181&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54181&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54181&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54181&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54181&r=mysqlcfg

Reply via email to