Making WordPress.org


Ignore:
Timestamp:
04/08/2025 02:18:41 AM (20 months ago)
Author:
dd32
Message:

Plugin Directory: SVN: Ensure that shell_exec returns an string.
This resolves a PHP Deprecated warning when a command produces no output, which triggers:
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

File:
1 edited

Legend:

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

    r14314 r14414  
    593593         *
    594594         * @param string $command The command to be executed.
    595          * @return mixed The output from the executed command or NULL if an error occurred or the command produces no
    596          *               output.
     595         * @return mixed The output from the executed command, empty string if an error occurred or the command
     596         *               produces no output.
    597597         */
    598598        protected static function shell_exec( $command ) {
    599                 return shell_exec( 'export LC_CTYPE="en_US.UTF-8" LANG="en_US.UTF-8"; ' . $command );
     599                return shell_exec( 'export LC_CTYPE="en_US.UTF-8" LANG="en_US.UTF-8"; ' . $command ) ?? '';
    600600        }
    601601}
Note: See TracChangeset for help on using the changeset viewer.