Permalink
Browse files

Fixed bug #71003: Add PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT

  • Loading branch information...
krallin authored and nikic committed Jun 9, 2016
1 parent b224e74 commit 247ce052cd0fc7d0d8ea1a0e7ea2075e9601766a
4 NEWS
@@ -13,6 +13,10 @@ PHP NEWS
. Fixed bug #74159 (Writing a large buffer to a non-blocking encrypted stream
fails with "bad write retry"). (trowski)
- PDO MySQL:
. Fixed bug #71003 (Expose MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT to PDO
interface). (Thomas Orozco)
16 Mar 2017 PHP 7.0.17
- Core:
@@ -736,6 +736,18 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
}
}
#endif
#ifdef PDO_USE_MYSQLND
{
zend_long ssl_verify_cert = pdo_attr_lval(driver_options,
PDO_MYSQL_ATTR_SSL_VERIFY_SERVER_CERT, -1);
if (ssl_verify_cert != -1) {
connect_opts |= ssl_verify_cert ?
CLIENT_SSL_VERIFY_SERVER_CERT:
CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
}
}
#endif
}
#ifdef PDO_MYSQL_HAS_CHARSET
@@ -130,6 +130,9 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (zend_long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY);
#endif
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MULTI_STATEMENTS", (zend_long)PDO_MYSQL_ATTR_MULTI_STATEMENTS);
#ifdef PDO_USE_MYSQLND
REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_VERIFY_SERVER_CERT", (zend_long)PDO_MYSQL_ATTR_SSL_VERIFY_SERVER_CERT);
#endif
#ifdef PDO_USE_MYSQLND
mysqlnd_reverse_api_register_api(&pdo_mysql_reverse_api);
@@ -179,6 +179,9 @@ enum {
PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY,
#endif
PDO_MYSQL_ATTR_MULTI_STATEMENTS,
#ifdef PDO_USE_MYSQLND
PDO_MYSQL_ATTR_SSL_VERIFY_SERVER_CERT,
#endif
};
#endif
@@ -27,6 +27,7 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
"MYSQL_ATTR_SSL_CIPHER" => true,
"MYSQL_ATTR_COMPRESS" => true,
"MYSQL_ATTR_MULTI_STATEMENTS" => true,
"MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true,
);
if (!MySQLPDOTest::isPDOMySQLnd()) {

0 comments on commit 247ce05

Please sign in to comment.