[wp-trac] [WordPress Trac] #34526: Minor mistake in wp_get_installed_translations function which causes little flood in error log

WordPress Trac noreply at wordpress.org
Sat Oct 31 13:13:56 UTC 2015


#34526: Minor mistake in wp_get_installed_translations function which causes little
flood in error log
--------------------------+-----------------------------
 Reporter:  Profforg      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 There are a minor mistake in wp_get_installed_translations function in
 file wp-includes/l10n.php at line 821 (ver 4.3.1)
 https://github.com/WordPress/WordPress/blob/4.3-branch/wp-
 includes/l10n.php#L821

 Affected versions: 3.7.0 - trunk

 Current line:

 {{{#!php
 if ( '.' === $file[0] || is_dir( $file ) ) {
 }}}

 How it should look like:

 {{{#!php
 if ( '.' === $file[0] || is_dir( WP_LANG_DIR . "$dir/$file" ) ) {
 }}}

 Description:
 Output of "scandir" function contains only filenames without full path.
 For some reason on the problematic line this is not taken into account.
 PHP tries to execute "is_dir" on for example "plugins" which does not work
 correctly in secured environments if "open_basedir" value is configured.
 Example error being logged on each execution of
 wp_get_installed_translations():

 {{{
 is_dir(): open_basedir restriction in effect. File(plugins) is not within
 the allowed path(s): ({open_basedir value}) in /var/www/website.com/wp-
 includes/l10n.php on line 821
 }}}

 Fixed line will execute "is_dir()" on full path which will not return
 errors and should work in all environments.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34526>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list