Making WordPress.org

Changeset 14375


Ignore:
Timestamp:
02/05/2025 03:20:13 AM (12 months ago)
Author:
dd32
Message:

Plugin Directory: Resolve PHP fatal ultimately caused by [14373] that serialised the steps array to an object.

This occured as json_encode( [ 2 => 'two' ] ) is an object, where as json_encode( [ 'one' ] ) is an array.

Follow up to [14373].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r14373 r14375  
    13051305            $has_self_install_step = false;
    13061306            if ( isset( $decoded_file[ 'steps' ] ) ) {
    1307                 $decoded_file[ 'steps' ] = array_filter( $decoded_file[ 'steps' ] ); // Null items are often present in auto-generated blueprints.
     1307                // Null & falsey items are often present in auto-generated blueprints, reindex to avoid serialising to an object.
     1308                $decoded_file[ 'steps' ] = array_values( array_filter( $decoded_file[ 'steps' ] ) );
    13081309
    13091310                foreach ( $decoded_file[ 'steps' ] as &$step ) {
Note: See TracChangeset for help on using the changeset viewer.