]> granicus.if.org Git - php/commitdiff
Deprecate mysqli driver_version property
authorDharman <tekiela246@gmail.com>
Sat, 13 Mar 2021 19:06:17 +0000 (19:06 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 15 Mar 2021 09:48:36 +0000 (10:48 +0100)
The driver version hasn't been updated in 13 years, so this number
is essentially meaningless. Check PHP_VERSION_ID instead.

UPGRADING
ext/mysqli/mysqli_driver.c
ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
ext/mysqli/tests/mysqli_driver.phpt

index cef46be99f52e3b1d1aaab50c22dca4bd0c7f04f..db0e1d484393c54592baa844dd4af81467f152ad 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -212,6 +212,11 @@ PHP 8.1 UPGRADE NOTES
 4. Deprecated Functionality
 ========================================
 
+- MySQLi:
+  . The mysqli_driver::$driver_version property has been deprecated. The driver
+    version is meaningless as it hasn't been updated in more than a decade. Use
+    PHP_VERSION_ID instead.
+
 ========================================
 5. Changed Functions
 ========================================
index 67f18fafa989be7007459909186500aa277902a4..7f98faf996a2710370fa66eb0ab724476979aeaa 100644 (file)
@@ -78,6 +78,7 @@ static int driver_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
 /* {{{ property driver_driver_version_read */
 static int driver_driver_version_read(mysqli_object *obj, zval *retval, bool quiet)
 {
+       zend_error(E_DEPRECATED, "The driver_version property is deprecated");
        ZVAL_LONG(retval, MYSQLI_VERSION_ID);
        return SUCCESS;
 }
index 32d13d6750af6276ee23246c6f217b73a75c511e..e5ffc262abab4450f82f0a41ef121dceebd471f8 100644 (file)
@@ -54,7 +54,6 @@ printf("driver->client_info = '%s'\n", $driver->client_info);
 assert(mysqli_get_client_version() === $driver->client_version);
 printf("driver->client_version = '%s'\n", $driver->client_version);
 
-assert($driver->driver_version > 0);
 printf("driver->driver_version = '%s'\n", $driver->driver_version);
 
 assert(in_array($driver->report_mode, [
@@ -103,6 +102,8 @@ report_mode
 Magic, magic properties:
 driver->client_info = '%s'
 driver->client_version = '%d'
+
+Deprecated: The driver_version property is deprecated in %s on line %d
 driver->driver_version = '%d'
 driver->report_mode = '%d'
 driver->reconnect = ''
index be2c61919bd947b2651583065a4a0f6ecfd1e5ec..a756766df6e2c337cd61b0e9beb22b7a609782f4 100644 (file)
@@ -27,11 +27,6 @@ if (($tmp = $driver->client_version) !== $client_version) {
     gettype($tmp), $tmp);
 }
 
-if (!is_int($tmp = $driver->driver_version) || (0 == $tmp)) {
-    printf("[004] Expecting int/any, got %s/%s\n",
-    gettype($tmp), $tmp);
-}
-
 $all_modes = [
     MYSQLI_REPORT_ALL,
     MYSQLI_REPORT_STRICT,