Index: ext/pdo_mysql/mysql_driver.c
--- ext/pdo_mysql/mysql_driver.c.orig	2024-12-17 16:31:31.000000000 +0100
+++ ext/pdo_mysql/mysql_driver.c	2025-01-01 16:42:37.463522000 +0100
@@ -884,7 +884,7 @@
 			}
 		}
 
-#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
+#if MYSQL_VERSION_ID > 50605 && defined(PDO_USE_MYSQLND)
 		{
 			zend_string *public_key = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY, NULL);
 			if (public_key) {
Index: ext/pdo_mysql/pdo_mysql.c
--- ext/pdo_mysql/pdo_mysql.c.orig	2025-01-01 16:42:37.463647000 +0100
+++ ext/pdo_mysql/pdo_mysql.c	2025-01-01 16:43:05.542084000 +0100
@@ -134,7 +134,7 @@
 	REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (zend_long)PDO_MYSQL_ATTR_SSL_CA);
 	REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (zend_long)PDO_MYSQL_ATTR_SSL_CAPATH);
 	REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (zend_long)PDO_MYSQL_ATTR_SSL_CIPHER);
-#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
+#if MYSQL_VERSION_ID > 50605 && defined(PDO_USE_MYSQLND)
 	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);
Index: ext/pdo_mysql/php_pdo_mysql_int.h
--- ext/pdo_mysql/php_pdo_mysql_int.h.orig	2024-12-17 16:31:31.000000000 +0100
+++ ext/pdo_mysql/php_pdo_mysql_int.h	2025-01-01 16:42:37.463777000 +0100
@@ -175,7 +175,7 @@
 	PDO_MYSQL_ATTR_SSL_CA,
 	PDO_MYSQL_ATTR_SSL_CAPATH,
 	PDO_MYSQL_ATTR_SSL_CIPHER,
-#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
+#if MYSQL_VERSION_ID > 50605 && defined(PDO_USE_MYSQLND)
 	PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY,
 #endif
 	PDO_MYSQL_ATTR_MULTI_STATEMENTS,
