Making WordPress.org

Changeset 14773


Ignore:
Timestamp:
03/28/2026 07:57:06 PM (7 days ago)
Author:
obenland
Message:

Plugin Directory: Fix PHP warnings when building plugin ZIPs and checking block plugins.

When an SVN export fails but the error details aren't available, the code
tried to read them anyway, triggering warnings. Add a fallback so a
generic message is used instead.

Also fixes a typo in a constant name that would have caused a fatal error
when a plugin directory turned out to be empty.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

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

    r12356 r14773  
    249249                __FUNCTION__,
    250250                'error',
    251                 sprintf( __( 'Error fetching repository %s: %s', 'wporg-plugins' ), $svn_url, $export['errors'][0]['error_code'] ),
    252                 $export['errors']
     251                sprintf( __( 'Error fetching repository %s: %s', 'wporg-plugins' ), $svn_url, $export['errors'][0]['error_code'] ?? 'unknown error' ),
     252                $export['errors'] ?? array()
    253253            );
    254254            return false;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php

    r14432 r14773  
    396396        }
    397397        if ( ! $res['result'] ) {
    398             throw new Exception( __METHOD__ . ': ' . $res['errors'][0]['error_message'], 404 );
     398            throw new Exception( __METHOD__ . ': ' . ( $res['errors'][0]['error_message'] ?? 'unknown error' ), 404 );
    399399        }
    400400
     
    404404        // Verify that the specified plugin zip will contain files.
    405405        if ( ! array_diff( scandir( $this->tmp_build_dir ), array( '.', '..' ) ) ) {
    406             throw new Exception( ___METHOD__ . ': No files exist in the plugin directory', 404 );
     406            throw new Exception( __METHOD__ . ': No files exist in the plugin directory', 404 );
    407407        }
    408408
Note: See TracChangeset for help on using the changeset viewer.