If a get a table with empty extra row values, I see deprecation warnings in PHP 8.2.
wp post list
+-----+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
| ID | post_title | post_name | post_date | post_status |
+-----+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
| 729 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor | lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor | 2023-07-14 09:49:45 | publish |
+-----+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
wp post list
Deprecated: grapheme_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /parship/lamp/htdocs/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/cli.php on line 329
Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /parship/lamp/htdocs/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/cli.php on line 331
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /parship/lamp/htdocs/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/Colors.php on line 215
Deprecated: str_pad(): Passing null to parameter #1 ($string) of type string is deprecated in /parship/lamp/htdocs/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/Colors.php on line 218
...
+-----+-------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
| ID | post_title | post_name | post_date | post_status |
+-----+-------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
| 729 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tem | lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor | 2023-07-14 09:49:45 | publish |
| | por | | | |
+-----+-------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------+---------------------+-------------+
Let us know what environment you are running this on
Bug Report
Describe the current, buggy behavior
If a get a table with empty extra row values, I see deprecation warnings in PHP 8.2.
wp post list
wp post list
Let us know what environment you are running this on
Provide a possible solution
https://github.com/wp-cli/php-cli-tools/blob/22270f4e4cafdd72c439150817412b8c04387798/lib/cli/table/Ascii.php#L183
We should check if the array is empty: