#42898 closed defect (bug) (fixed)
Make sure get_cli_args() operates on an array
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Import | Keywords: | has-patch |
| Focuses: | Cc: |
Description
The get_cli_args() function in wp-admin/includes/class-wp-importer.php asks for an array from $_SERVER['argv']. However, it is possible for $_SERVER['argv'] to be NULL. In that case sizeof() gets called on a non-countable variable, resulting in a warning like this under PHP 7.2:
Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/wpcom/public_html/wp-admin/includes/class-wp-importer.php on line 283
By making sure that $args is always an array we can fix that:
if ( !is_array( $args ) ) {
$args = array();
}
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
In 42771: