WordPress.org

Make WordPress Core

Ticket #40037: 40037.2.diff

File 40037.2.diff, 1.4 KB (added by birgire, 21 months ago)
  • src/wp-includes/wp-db.php

    diff --git src/wp-includes/wp-db.php src/wp-includes/wp-db.php
    index 901cf10..76d9f61 100644
    class wpdb { 
    35073507         * @return null|string Null on failure, version number on success.
    35083508         */
    35093509        public function db_version() {
    3510                 if ( $this->use_mysqli ) {
    3511                         $server_info = mysqli_get_server_info( $this->dbh );
    3512                 } else {
    3513                         $server_info = mysql_get_server_info( $this->dbh );
    3514                 }
    3515                 return preg_replace( '/[^0-9.].*/', '', $server_info );
     3510                return preg_replace( '/[^0-9.].*/', '', $this->db_server_info() );
     3511        }
     3512
     3513        /**
     3514         * Retrieves full MySQL server information.
     3515         *
     3516         * @since 5.0.0
     3517         *
     3518         * @return null|string Null on failure, server info on success.
     3519         */
     3520        public function db_server_info() {
     3521                return $this->use_mysqli ?
     3522                        mysqli_get_server_info( $this->dbh ) :
     3523                        mysql_get_server_info( $this->dbh );
    35163524        }
    35173525}
  • tests/phpunit/tests/db/charset.php

    diff --git tests/phpunit/tests/db/charset.php tests/phpunit/tests/db/charset.php
    index e0f9df2..271631e 100644
    class Tests_DB_Charset extends WP_UnitTestCase { 
    2929
    3030                self::$_wpdb = new wpdb_exposed_methods_for_testing();
    3131
    32                 if ( self::$_wpdb->use_mysqli ) {
    33                         self::$server_info = mysqli_get_server_info( self::$_wpdb->dbh );
    34                 } else {
    35                         self::$server_info = mysql_get_server_info( self::$_wpdb->dbh );
    36                 }
     32                self::$server_info = self::$_wpdb->db_server_info();
    3733        }
    3834
    3935        /**