[PHP-BUG] Bug #55283 [NEW]: SSL options set by mysqli_ssl_set ignored for MySQLi persistent connections

2011-07-25 Thread aleksey at wepay dot com
From: 
Operating system: Cent OS
PHP version:  5.3.6
Package:  MySQLi related
Bug Type: Bug
Bug description:SSL options set by mysqli_ssl_set ignored for MySQLi persistent 
connections

Description:

The MySQLi ignores SSL options set with mysqli_ssl_set() for persistent
connections (works fine for non-persistent connections).

To reproduce:
1) Configure MySQL server with SSL support
(http://dev.mysql.com/doc/refman/5.0/en/secure-connections.html)
2) Run the attached test script



Test script:
---
?
$host  = 'localhost';
$user  = 'root';
$pass  = '';
$db= null;
$port  = 3306;
$flags = MYSQLI_CLIENT_SSL;

/* persistent connection */
$link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, RC4-MD5);
if (mysqli_real_connect($link, 'p:' . $host, $user, $pass, $db, $port,
null, $flags)) {
$r = $link-query(SHOW STATUS LIKE 'Ssl_cipher');
var_dump($r-fetch_row());
}

/* non-persistent connection */
$link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, RC4-MD5);
if (mysqli_real_connect($link, $host, $user, $pass, $db, $port, null,
$flags)) {
$r = $link-query(SHOW STATUS LIKE 'Ssl_cipher');
var_dump($r-fetch_row());
}


Expected result:

array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(18) RC4-MD5
}
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(7) RC4-MD5
}


Actual result:
--
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(18) DHE-RSA-AES256-SHA
}
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(7) RC4-MD5
}


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



Bug #55283 [Opn]: SSL options set by mysqli_ssl_set ignored for MySQLi persistent connections

2011-07-25 Thread aleksey at wepay dot com
Edit report at https://bugs.php.net/bug.php?id=55283edit=1

 ID: 55283
 User updated by:aleksey at wepay dot com
 Reported by:aleksey at wepay dot com
 Summary:SSL options set by mysqli_ssl_set ignored for MySQLi
 persistent connections
 Status: Open
 Type:   Bug
 Package:MySQLi related
 Operating System:   Cent OS
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Please note that while the example shows the problem with the cipher, all other 
parameters are also ignored. In particular, ssl cert info is critical.


Previous Comments:

[2011-07-26 00:20:58] aleksey at wepay dot com

Description:

The MySQLi ignores SSL options set with mysqli_ssl_set() for persistent 
connections (works fine for non-persistent connections).

To reproduce:
1) Configure MySQL server with SSL support 
(http://dev.mysql.com/doc/refman/5.0/en/secure-connections.html)
2) Run the attached test script



Test script:
---
?
$host  = 'localhost';
$user  = 'root';
$pass  = '';
$db= null;
$port  = 3306;
$flags = MYSQLI_CLIENT_SSL;

/* persistent connection */
$link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, RC4-MD5);
if (mysqli_real_connect($link, 'p:' . $host, $user, $pass, $db, $port, null, 
$flags)) {
$r = $link-query(SHOW STATUS LIKE 'Ssl_cipher');
var_dump($r-fetch_row());
}

/* non-persistent connection */
$link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, RC4-MD5);
if (mysqli_real_connect($link, $host, $user, $pass, $db, $port, null, $flags)) {
$r = $link-query(SHOW STATUS LIKE 'Ssl_cipher');
var_dump($r-fetch_row());
}


Expected result:

array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(18) RC4-MD5
}
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(7) RC4-MD5
}


Actual result:
--
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(18) DHE-RSA-AES256-SHA
}
array(2) {
  [0]=
  string(10) Ssl_cipher
  [1]=
  string(7) RC4-MD5
}







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55283edit=1