Skip to content

Commit b74ae19

Browse files
authored
Partially revert #117 (#118)
There's more nuance to the type of the returned value than #117 antitipated. With that PR in, WooCommerce wouldn't work: ``` [06-Jun-2024 16:21:26 UTC] PHP Fatal error: Uncaught TypeError: get_object_vars(): Argument #1 ($object) must be of type object, string given in /wordpress/wp-includes/class-wpdb.php:3 Stack trace: #0 /wordpress/wp-includes/class-wpdb.php(3): get_object_vars('wp_wc_product_a...') #1 /wordpress/wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php(69): wpdb->get_var('SHOW TABLES LIK...') #2 /wordpress/wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php(650): Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore->check_lookup_table_exists() ``` Let's revert and revisit later on cc @bgrgicak @wojtekn
1 parent ff09e42 commit b74ae19

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

tests/WP_SQLite_Translator_Tests.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,9 @@ public function testShowTablesLike() {
453453
);
454454
$this->assertEquals(
455455
array(
456-
'_tmp_table',
456+
(object) array(
457+
'Tables_in_db' => '_tmp_table',
458+
),
457459
),
458460
$this->engine->get_query_results()
459461
);

wp-includes/sqlite/class-wp-sqlite-translator.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,10 +3462,7 @@ private function execute_show() {
34623462
);
34633463

34643464
$this->set_results_from_fetched_data(
3465-
array_column(
3466-
$stmt->fetchAll( $this->pdo_fetch_mode ),
3467-
'Tables_in_db'
3468-
)
3465+
$stmt->fetchAll( $this->pdo_fetch_mode )
34693466
);
34703467
return;
34713468

@@ -3476,10 +3473,7 @@ private function execute_show() {
34763473
"SELECT name FROM sqlite_master WHERE type='table'"
34773474
);
34783475
$this->set_results_from_fetched_data(
3479-
array_column(
3480-
$stmt->fetchAll( $this->pdo_fetch_mode ),
3481-
'Tables_in_db'
3482-
)
3476+
$stmt->fetchAll( $this->pdo_fetch_mode )
34833477
);
34843478
return;
34853479

0 commit comments

Comments
 (0)