| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2017-01-23 11:48 UTC] requinix@php.net
 
-Status: Open
+Status: Feedback
  [2017-01-23 11:48 UTC] requinix@php.net
  [2017-01-23 12:01 UTC] schmittjoh at gmail dot com
  [2017-01-23 17:09 UTC] dz at heroku dot com
  [2017-01-24 12:22 UTC] bukka@php.net
 
-Status:      Feedback
+Status:      Assigned
-Assigned To:
+Assigned To: bukka
  [2017-01-24 12:22 UTC] bukka@php.net
  [2017-01-24 12:35 UTC] bukka@php.net
 
-Package: PDO MySQL
+Package: OpenSSL related
  [2017-01-25 07:37 UTC] requinix@php.net
  [2017-01-25 19:55 UTC] bukka@php.net
  [2017-01-25 19:55 UTC] bukka@php.net
 
-Status: Assigned
+Status: Closed
  [2017-01-25 19:56 UTC] bukka@php.net
  [2020-02-20 06:10 UTC] liton10 at gmail dot com
  [2020-02-20 08:26 UTC] nikic@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Mon Nov 03 23:00:01 2025 UTC | 
Description: ------------ We get an SSL error when connecting to a secure MySQL server for some queries: Warning: PDOStatement::execute(): SSL operation failed with code 1. OpenSSL Error messages: error:0607A082:digital envelope routines:EVP_CIPHER_CTX_set_key_length:invalid key length error:0607A082:digital envelope routines:EVP_CIPHER_CTX_set_key_length:invalid key length The error happens for the next query after we used the openssl_decrypt function in our code. It seems like this function is not properly encapsulated or leaves some state behind which then triggers the error in PDO. I was not able to reproduce a test-case with values that would not expose our secret, but making a second call to openssl_decrypt with no meaningful values fixes it. Test script: --------------- // This query runs fine. $con->prepare("SELECT 1")->execute()->fetchColumn(); // This call leaves some state behind that causes error on second query. openssl_decrypt(/* real arguments here */); // Adding a call like this works around the bug. // openssl_decrypt('', 'AES-256-CBC', '', 0, ''); // Error on this query. $con->prepare("SELECT 1")->execute()->fetchColumn();