Skip to content

Bugfixes in SHOW CREATE TABLE and SHOW TABLES #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Jun 5, 2024

Fixes a series of crashes encountered when

  • SHOW TABLES now returns a flat list, not an array of objects – I'm not sure here. It makes $tables = $wpdb->get_results("SHOW TABLES LIKE '{$prefix}%'", ARRAY_N); work as expected here, but is the right thing to return, or is this more about correct handling of the fetch mode, like ARRAY_N?
  • SHOW tables isn't all uppercase
  • There's no table tho SHOW CREATE: SHOW CREATE TABLE _no_such_table;
  • The table identifier passed to SHOW CREATE is quoted:
'SHOW CREATETABLE `_tmp_table`;'

This PR makes the Sandbox site plugin work in Playground

cc @bgrgicak @brandonpayton @wojtekn

Fixes a series of crashes encountered when

* SHOW TABLES now returns a flat list, not an array of objects
* `SHOW tables` isn't all uppercase
* There's no table tho SHOW CREATE: `SHOW CREATE TABLE _no_such_table;`
* The table identifier passed to SHOW CREATE is quoted:

```
'SHOW CREATETABLE `_tmp_table`;'
```
@adamziel adamziel changed the title Fix SHOW CREATE TABLE and SHOW TABLES Bugfixes in SHOW CREATE TABLE and SHOW TABLES Jun 5, 2024
@adamziel
Copy link
Collaborator Author

adamziel commented Jun 5, 2024

This solves a real problem so I'll go ahead and merge, but let's revisit in case there's more to SHOW TABLES and returning a flat list. Also, GitHub says all checks are still in progress when I can see they passed:

CleanShot 2024-06-06 at 01 24 38@2x

@adamziel adamziel merged commit ff09e42 into main Jun 5, 2024
9 checks passed
adamziel added a commit that referenced this pull request Jun 6, 2024
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:
```

Let's revert and revisit later on
@adamziel adamziel mentioned this pull request Jun 6, 2024
adamziel added a commit that referenced this pull request Jun 6, 2024
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
@aristath aristath deleted the fix-show-tables-like-and-show-create-table branch June 10, 2024 07:07
adamziel added a commit that referenced this pull request Aug 11, 2024
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:
```

Let's revert and revisit later on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant