Bug #74555 [NEW]: mysqli_select_db() fails after unrelated openssl calls

From: Date: Mon, 08 May 2017 15:17:24 +0000
Subject: Bug #74555 [NEW]: mysqli_select_db() fails after unrelated openssl calls
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208997@lists.php.net to get a copy of this message
From:             spam2 at rhsoft dot net
Operating system: 
PHP version:      7.0.18
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli_select_db() fails after unrelated openssl calls

Description:
------------
* i have two encrypted database connections to different servers
* all is fine including mysqli_select_db() before each command
* $cl_api->crypto->decrypt($password_crypted, $this->secure_hash) and
  a following mysqli_select_db() in unrelated code and all dies
___________________________________

$cl_api->crypto->decrypt($password_crypted, $this->secure_hash is
basically the following code - i just removed the mysqli_select_db() as
workaround globally and so the code finished before trigger the problem

private $hash_algo = 'sha256';
private $iv_length;
openssl_decrypt($raw, $this->cipher_algo, openssl_digest($key,
$this->hash_algo, true), OPENSSL_RAW_DATA, $iv);
___________________________________

mysqli_select_db() is basically there because at least years ago when
working with persistent connections changing the database for one
instance changed it also for the other when you used the same
credentials and so my database class started switch back to the database
of it's own instance before issue any other command

___________________________________

[root@arrakis:~]$ cat messages
May  8 16:51:06 arrakis panel: sftp: Passwortanzeige aktiviert
(reindl)
PHP Warning:  mysqli_select_db() [<a
href='http://at.php.net/manual/de/function.mysqli-select-db.php'>function.mysqli-select-db.php</a>]:
SSL operation failed with code 1. OpenSSL Error
messages:#012error:0607A082:digital envelope
routines:EVP_CIPHER_CTX_set_key_length:invalid key length in
global_mysql_class.inc.php on line 340
PHP Warning:  mysqli_select_db() [<a
href='http://at.php.net/manual/de/function.mysqli-select-db.php'>function.mysqli-select-db.php</a>]:
MySQL server has gone away in global_mysql_class.inc.php on line 340
PHP Warning:  mysqli_select_db() [<a
href='http://at.php.net/manual/de/function.mysqli-select-db.php'>function.mysqli-select-db.php</a>]:
Error while reading INIT_DB's OK packet. PID=15511 in
global_mysql_class.inc.php on line 340
DATABASE-ERROR: show_content.php - /docroot/sftp/library.php line 381
(parent call: /docroot/sftp/module.php on line 346): Datenbank pam_mysql
ist nicht vorhanden. - MySQL server has gone away


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



Thread (3 messages)

« previous php.bugs (#208997) next »