Make WordPress Core


Ignore:
Timestamp:
07/27/2015 06:04:19 PM (9 years ago)
Author:
markjaquith
Message:

Don't blindly trust the output of glob() to be an array.

props kitchin
fixes #33093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n.php

    r33230 r33447  
    775775    $languages = array();
    776776
    777     foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
    778         $lang_file = basename($lang_file, '.mo');
    779         if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
    780             0 !== strpos( $lang_file, 'admin-' ))
    781             $languages[] = $lang_file;
     777    $lang_files = glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' );
     778    if ( $lang_files ) {
     779        foreach( $lang_files as $lang_file ) {
     780            $lang_file = basename( $lang_file, '.mo' );
     781            if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
     782                0 !== strpos( $lang_file, 'admin-' ) ) {
     783                $languages[] = $lang_file;
     784            }
     785        }
    782786    }
    783787
Note: See TracChangeset for help on using the changeset viewer.