Skip to content

Commit

Permalink
Partially revert #117 (#118)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adamziel authored Jun 6, 2024
1 parent ff09e42 commit b74ae19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/WP_SQLite_Translator_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,9 @@ public function testShowTablesLike() {
);
$this->assertEquals(
array(
'_tmp_table',
(object) array(
'Tables_in_db' => '_tmp_table',
),
),
$this->engine->get_query_results()
);
Expand Down
10 changes: 2 additions & 8 deletions wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3462,10 +3462,7 @@ private function execute_show() {
);

$this->set_results_from_fetched_data(
array_column(
$stmt->fetchAll( $this->pdo_fetch_mode ),
'Tables_in_db'
)
$stmt->fetchAll( $this->pdo_fetch_mode )
);
return;

Expand All @@ -3476,10 +3473,7 @@ private function execute_show() {
"SELECT name FROM sqlite_master WHERE type='table'"
);
$this->set_results_from_fetched_data(
array_column(
$stmt->fetchAll( $this->pdo_fetch_mode ),
'Tables_in_db'
)
$stmt->fetchAll( $this->pdo_fetch_mode )
);
return;

Expand Down

0 comments on commit b74ae19

Please sign in to comment.