Wrong textdomain path on IIS
-
I have a WordPress installation on my IIS in Windows and I just wanted to install the “Crayon syntax highlighter”. The plugin caused a wrong textdomain loading. The path to the plugin directory is added twice to the mofile path.
PHP Warning: is_readable(): open_basedir restriction in effect. File(C:\Inetpub\vhosts\mysite.net\httpdocs/wp-content/plugins/C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter/trans/crayon-syntax-highlighter-en_US.mo) is not within the allowed path(s): (C:\Inetpub\vhosts\coderline.net\httpdocs\;C:\inetpub\vhosts\mysite.net\temp) in C:\Inetpub\vhosts\mysite.net\httpdocs\wp-includes\l10n.php on line 339I checked the source codes and it seems there is a bug within the WordPress core.
Here my trace:
array(9) { [0]=> array(4) { ["file"]=> string(61) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-includes\l10n.php" ["line"]=> int(434) ["function"]=> string(15) "load_textdomain" ["args"]=> array(2) { [0]=> &string(25) "crayon-syntax-highlighter" [1]=> &string(186) "C:\Inetpub\vhosts\mysite.net\httpdocs/wp-content/plugins/C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter/trans/crayon-syntax-highlighter-en_US.mo" } } [1]=> array(4) { ["file"]=> string(69) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-admin\includes\plugin.php" ["line"]=> int(121) ["function"]=> string(22) "load_plugin_textdomain" ["args"]=> array(3) { [0]=> &string(25) "crayon-syntax-highlighter" [1]=> &bool(false) [2]=> &string(92) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter/trans/" } } [2]=> array(4) { ["file"]=> string(69) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-admin\includes\plugin.php" ["line"]=> int(99) ["function"]=> string(33) "_get_plugin_data_markup_translate" ["args"]=> array(4) { [0]=> &string(105) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter\crayon_wp.class.php" [1]=> &array(9) { ["Name"]=> string(25) "Crayon Syntax Highlighter" ["PluginURI"]=> string(54) "http://ak.net84.net/projects/crayon-syntax-highlighter" ["Version"]=> string(4) "1.10" ["Description"]=> string(86) "Supports multiple languages, themes, highlighting from a URL, local file or post text." ["Author"]=> string(14) "Aram Kocharyan" ["AuthorURI"]=> string(20) "http://ak.net84.net/" ["TextDomain"]=> string(25) "crayon-syntax-highlighter" ["DomainPath"]=> string(7) "/trans/" ["Network"]=> bool(false) } [2]=> &bool(true) [3]=> &bool(true) } } [3]=> array(4) { ["file"]=> string(105) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter\crayon_wp.class.php" ["line"]=> int(35) ["function"]=> string(15) "get_plugin_data" ["args"]=> array(1) { [0]=> &string(105) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter\crayon_wp.class.php" } } [4]=> array(4) { ["file"]=> string(56) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-settings.php" ["line"]=> int(198) ["args"]=> array(1) { [0]=> string(105) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-content\plugins\crayon-syntax-highlighter\crayon_wp.class.php" } ["function"]=> string(12) "include_once" } [5]=> array(4) { ["file"]=> string(54) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-config.php" ["line"]=> int(90) ["args"]=> array(1) { [0]=> string(56) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-settings.php" } ["function"]=> string(12) "require_once" } [6]=> array(4) { ["file"]=> string(52) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-load.php" ["line"]=> int(29) ["args"]=> array(1) { [0]=> string(54) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-config.php" } ["function"]=> string(12) "require_once" } [7]=> array(4) { ["file"]=> string(59) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-admin\admin.php" ["line"]=> int(30) ["args"]=> array(1) { [0]=> string(52) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-load.php" } ["function"]=> string(12) "require_once" } [8]=> array(4) { ["file"]=> string(61) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-admin\plugins.php" ["line"]=> int(10) ["args"]=> array(1) { [0]=> string(59) "C:\Inetpub\vhosts\mysite.net\httpdocs\wp-admin\admin.php" } ["function"]=> string(12) "require_once" } }Within the _get_plugin_data_markup_translate (wp-admin\plugin.php line 121) the third parameter of the load_plugin_textdomain call is wrong:
dirname($plugin_file) . $plugin_data['DomainPath']At this part an absolute path to the file is created, but the load_plugin_textdomain requires a relative path! Within the load_plugin_textdomain the WP_PLUGIN_DIR is added again to the path.
The solution would be to change the _get_plugin_data_markup_translate. (notice the basename)
function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) { // Translate fields if ( $translate ) { if ( $textdomain = $plugin_data['TextDomain'] ) { if ( $plugin_data['DomainPath'] ) load_plugin_textdomain( $textdomain, false, basename( dirname( $plugin_file ) ) . $plugin_data['DomainPath'] ); else load_plugin_textdomain( $textdomain, false, basename( dirname( $plugin_file ) ) ); } elseif ( in_array( basename( $plugin_file ), array( 'hello.php', 'akismet.php' ) ) ) { $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain ); } } ...Is this a known bug?
The topic ‘Wrong textdomain path on IIS’ is closed to new replies.