Making WordPress.org

Changeset 14488


Ignore:
Timestamp:
07/24/2025 01:15:10 AM (11 months ago)
Author:
dd32
Message:

API: Serve Happy & Credits: Protect against invalid inputs causing fatal errors.

Location:
sites/trunk/api.wordpress.org/public_html/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/credits/index.php

    r8349 r14488  
    4040}
    4141
    42 if ( version_compare( $version, '3.2', '<' ) ) {
     42if (
     43    ! is_string( $version ) ||
     44    version_compare( $version, '3.2', '<' ) ||
     45    ( isset( $_GET['locale'] ) && ! is_string( $_GET['locale'] ) )
     46) {
    4347    header( 'HTTP/1.0 400 Bad Request', true, 400 );
    4448    die( 'Bad request.' );
  • sites/trunk/api.wordpress.org/public_html/core/serve-happy/1.0/include.php

    r8065 r14488  
    1111    $php_version = false;
    1212    // PHP versions on hosts vary and include extra data, we're only interested in the major core PHP version component:
    13     if ( preg_match( '!^([0-9]+\.([0-9]+\.)?[0-9]+)!', $request['php_version'], $m ) ) {
     13    if (
     14        is_string( $request['php_version'] ) &&
     15        preg_match( '!^([0-9]+\.([0-9]+\.)?[0-9]+)!', $request['php_version'], $m )
     16    ) {
    1417        $php_version = $m[1];
    1518    }
Note: See TracChangeset for help on using the changeset viewer.