Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDO: Fix partial error return when using a encrypted connection #327

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

TAINCER
Copy link

@TAINCER TAINCER commented Feb 21, 2023

This fixes a problem with the original Zend1 repository we fixed in our fork a while ago. This only affects SSL MySQL connections, regular MySQL works fine.

How to reproduce (taken from the PHP bug report):

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 output

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 output

SQLSTATE[HY000] [2002]

@TAINCER TAINCER closed this Feb 21, 2023
@TAINCER
Copy link
Author

TAINCER commented Feb 22, 2023

Hey, I've updated the description, I didn't mean to open the PR without it.

@TAINCER TAINCER reopened this Feb 22, 2023
@glensc
Copy link
Collaborator

glensc commented Feb 22, 2023

looks solid. i always hated mysql error messages being useless

@glensc glensc merged commit 373285d into Shardj:master Feb 22, 2023
@TAINCER TAINCER deleted the fix-pdo-error-response-ssl branch February 22, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants