Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Fix: Restore $wpdb->use_mysqli for backward compatibility (#220)
Browse files Browse the repository at this point in the history
Co-authored-by: xxsimoxx <[email protected]>
  • Loading branch information
xxsimoxx and xxsimoxx authored Sep 21, 2023
1 parent c54f481 commit 872d0ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/wp-includes/class-wpdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,16 @@ class wpdb {
*/
private $allow_unsafe_unquoted_parameters = true;

/**
* Whether to use mysqli over mysql. Default false.
*
* @since 3.9.0
* @since CP-2.0.0 Defaults to true for backward compatibility.
*
* @var bool
*/
private $use_mysqli = true;

/**
* Whether we've managed to successfully connect at some point.
*
Expand Down
10 changes: 10 additions & 0 deletions tests/phpunit/tests/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -2469,4 +2469,14 @@ public function parse_db_host_data_provider() {
),
);
}

/**
* The wpdb->use_mysqli is true (for now), purely for backwards compatibility reasons.
*/
public function test_mysqli_is_set() {
global $wpdb;

$this->assertObjectHasAttribute( 'use_mysqli', $wpdb );
$this->assertTrue( $wpdb->use_mysqli );
}
}

0 comments on commit 872d0ae

Please sign in to comment.