Bug #76604 [NEW]: Incomplete/Partial error messages for encrypted connection failures

From: Date: Tue, 10 Jul 2018 12:37:38 +0000
Subject: Bug #76604 [NEW]: Incomplete/Partial error messages for encrypted connection failures
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216259@lists.php.net to get a copy of this message
From: johannes dot meyer at netways dot de Operating system: CentOS Linux release 7.4.1708 (C PHP version: 7.1.19 Package: PDO MySQL Bug Type: Bug Bug description:Incomplete/Partial error messages for encrypted connection failures Description: ------------ Trying to connect to a MariaDB instance using a SSL encrypted connection may fail. If it does, an PDOException's getMessage() method returns only an incomplete string. The returned error message defies any usefulness because the actual reason is not part of it. It's possible to workaround this since the exception object in question got a previous exception which holds the missing part. Though, actually expected is that method getMessage() already returns a proper message. Test script: --------------- try { $pdo = new PDO( 'mysql:host=localhost.localdomain;dbname=foo', 'foo', 'bar', array( PDO::MYSQL_ATTR_SSL_KEY => '/home/vagrant/newcerts/server-key.pem', PDO::MYSQL_ATTR_SSL_CERT => '/home/vagrant/newcerts/server-cert.pem', PDO::MYSQL_ATTR_SSL_CA => '/home/vagrant/newcerts/ca.pem', PDO::MYSQL_ATTR_SSL_CIPHER => 'DHE-RSA-AES256-GCM-SHA384' ) ); } catch (PDOException $e) { echo '# Actual:' . PHP_EOL; echo $e->getMessage() . PHP_EOL; echo '# Expected:' . PHP_EOL; echo $e->getMessage() . $e->getPrevious()->getMessage() . PHP_EOL; } Expected result: ---------------- # Actual: SQLSTATE[HY000] [2002] PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages: error:140830B5:SSL routines:ssl3_client_hello:no ciphers available # Expected: SQLSTATE[HY000] [2002] PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages: error:140830B5:SSL routines:ssl3_client_hello:no ciphers available Actual result: -------------- # Actual: SQLSTATE[HY000] [2002] # Expected: SQLSTATE[HY000] [2002] PDO::__construct(): SSL operation failed with code 1. OpenSSL Error messages: error:140830B5:SSL routines:ssl3_client_hello:no ciphers available -- Edit bug report at https://bugs.php.net/bug.php?id=76604&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76604&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76604&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76604&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76604&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76604&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76604&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76604&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76604&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76604&r=support Expected behavior: https://bugs.php.net/fix.php?id=76604&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76604&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76604&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76604&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76604&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76604&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76604&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76604&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76604&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76604&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76604&r=mysqlcfg

« previous php.bugs (#216259) next »