Closed wpbullet closed 2 years ago
Thanks for the report, @wpbullet !
Interestingly, it seems to work fine for me:
$ php -v
PHP 8.1.11 (cli) (built: Sep 29 2022 19:44:28) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.11, Copyright (c) Zend Technologies
with Zend OPcache v8.1.11, Copyright (c), by Zend Technologies
$ wp db size --tables --all-tables --orderby=size --order=desc --allow-root --size_format=mb
+-----------------------+------+
| Name | Size |
+-----------------------+------+
| wp_options | 1 MB |
| wp_comments | 0 MB |
| wp_posts | 0 MB |
| wp_users | 0 MB |
| wp_commentmeta | 0 MB |
| wp_postmeta | 0 MB |
| wp_term_taxonomy | 0 MB |
| wp_termmeta | 0 MB |
| wp_terms | 0 MB |
| wp_usermeta | 0 MB |
| wp_links | 0 MB |
| wp_term_relationships | 0 MB |
+-----------------------+------+
I'll see if I can get it to fail in GitHub actions...
Thanks @danielbachhuber that's very interesting it works for you
I tried with the --skip-plugins
and the --skip-packages
flags and still got the same error.
I was thinking it may have something to do with wp doctor
or wp profile
commands
@wpbullet The test seems to pass: https://github.com/wp-cli/db-command/actions/runs/3237164741/jobs/5303893706
However, this does seem incorrect:
Originated with https://github.com/wp-cli/db-command/pull/69
I think https://github.com/wp-cli/db-command/pull/230/commits/210ebcca1f28275d61c6a248a94da86d566ef9dd should fix the issue for you. Do you have an easy way to test?
Thank you for digging further @danielbachhuber !
I don't have an easy way to test that I'm aware of but if there is a guide on how to do that I'm happy to try. I searched the system for find . -iname DB_Command.php
but found no such file
@wpbullet Here's a Phar file you can test out!
@danielbachhuber you are a star! We have success:
./wp-cli-size-format-fail.phar --version --allow-root
WP-CLI 2.8.0-size-format-fail
root@wp-bullet:/var/www/wp-bullet.com# ./wp-cli-size-format-fail.phar db size --tables --all-tables --orderby=size --order=desc --allow-root --size_format=mb
Tada!
+------------------------------------+-------+
| Name | Size |
+------------------------------------+-------+
| wp_prli_clicks | 27 MB |
| wp_posts | 8 MB |
| wp_options | 7 MB |
| wp_postmeta | 2 MB |
| wp_aiowps_login_lockdown | 2 MB |
| wp_ewwwio_images | 1 MB |
| wp_yoast_indexable | 1 MB |
| wp_aiowps_failed_logins | 0 MB |
| wp_gf_entry_meta | 0 MB |
| wp_yoast_seo_links | 0 MB |
| wp_prli_links | 0 MB |
| wp_prli_link_metas | 0 MB |
| wp_comments | 0 MB |
| wp_edd_orders | 0 MB |
| wp_edd_order_addresses | 0 MB |
| wp_edd_customer_email_addresses | 0 MB |
| wp_edd_notes | 0 MB |
| wp_edd_order_transactions | 0 MB |
| wp_edd_ordermeta | 0 MB |
| wp_edd_subscriptions | 0 MB |
| wp_gf_form_view | 0 MB |
| wp_usermeta | 0 MB |
| wp_yoast_indexable_hierarchy | 0 MB |
| wp_edd_adjustments | 0 MB |
| wp_edd_customer_addresses | 0 MB |
| wp_edd_customers | 0 MB |
| wp_edd_logs | 0 MB |
| wp_edd_logs_api_requests | 0 MB |
| wp_prli_link_rotations | 0 MB |
| wp_edd_licensemeta | 0 MB |
| wp_edd_licenses | 0 MB |
| wp_edd_logs_file_downloads | 0 MB |
| wp_edd_order_adjustments | 0 MB |
| wp_edd_order_items | 0 MB |
| wp_prli_post_keywords | 0 MB |
| wp_prli_post_urls | 0 MB |
| wp_users | 0 MB |
| wp_affiliate_wp_affiliatemeta | 0 MB |
| wp_affiliate_wp_customermeta | 0 MB |
| wp_affiliate_wp_customers | 0 MB |
| wp_affiliate_wp_direct_links | 0 MB |
| wp_affiliate_wp_payouts | 0 MB |
| wp_affiliate_wp_referralmeta | 0 MB |
| wp_commentmeta | 0 MB |
| wp_edd_adjustmentmeta | 0 MB |
| wp_edd_customermeta | 0 MB |
| wp_edd_logmeta | 0 MB |
| wp_edd_logs_api_requestmeta | 0 MB |
| wp_edd_logs_file_downloadmeta | 0 MB |
| wp_edd_notemeta | 0 MB |
| wp_edd_order_adjustmentmeta | 0 MB |
| wp_edd_order_itemmeta | 0 MB |
| wp_gf_entry | 0 MB |
| wp_gf_entry_notes | 0 MB |
| wp_gf_form_meta | 0 MB |
| wp_gf_form_revisions | 0 MB |
| wp_prli_clicks_rotations | 0 MB |
| wp_prli_keywords | 0 MB |
| wp_prli_report_links | 0 MB |
| wp_prli_reports | 0 MB |
| wp_term_taxonomy | 0 MB |
| wp_termmeta | 0 MB |
| wp_terms | 0 MB |
| wp_yoast_primary_term | 0 MB |
| wp_yoast_seo_meta | 0 MB |
| wp_affiliate_wp_affiliates | 0 MB |
| wp_affiliate_wp_coupons | 0 MB |
| wp_affiliate_wp_creatives | 0 MB |
| wp_affiliate_wp_lifetime_customers | 0 MB |
| wp_affiliate_wp_referrals | 0 MB |
| wp_affiliate_wp_rest_consumers | 0 MB |
| wp_affiliate_wp_sales | 0 MB |
| wp_affiliate_wp_visits | 0 MB |
| wp_edd_license_activations | 0 MB |
| wp_edd_notifications | 0 MB |
| wp_ewwwio_queue | 0 MB |
| wp_gf_addon_feed | 0 MB |
| wp_gf_draft_submissions | 0 MB |
| wp_links | 0 MB |
| wp_prli_groups | 0 MB |
| wp_term_relationships | 0 MB |
| wp_yoast_migrations | 0 MB |
| wp_aiowps_events | 0 MB |
| wp_aiowps_global_meta | 0 MB |
| wp_aiowps_login_activity | 0 MB |
| wp_aiowps_permanent_block | 0 MB |
| wp_gf_form | 0 MB |
| wp_novashare_meta | 0 MB |
| wp_wpfm_backup | 0 MB |
| wp_datalist | 0 MB |
| wp_affiliate_wp_campaigns | 0 MB |
+------------------------------------+-------+
@wpbullet Sweet! We'll get this in a queue for a release then 😁
This fix was pushed as a patch release with release v2.7.1.
I was testing WP CLI 2.7.0 and the super handy new
--orderby=size
and--order=desc
flags.These flags work on their own but not when combined with the --size_format=mb flag (which I would hope to make the default since Bytes are not that human-friendly).
With this command under PHP 8.1:
Fatal error output
The same error happened without the --tables flag
PHP Version output
WP CLI version