Automattic / wp-cldr

Use CLDR localization data in WordPress
GNU General Public License v2.0
24 stars 6 forks source link

Error: fopen failed to open stream No such file or directory #84

Closed stuwest closed 8 years ago

stuwest commented 8 years ago

When re-installing the plugin on one of my old GoDaddy test sites running WP 4.4.2 on PHP 5.4.19 (after uninstalling an earlier version of the plugin) i got this:

screen shot 2016-03-17 at 2 26 16 pm

That text is:

Warning: fopen(/home/content/24/4682424/html/westfamilyblog/wp-content/plugins/wp-cldr/wp-cldr.php): failed to open stream: No such file or directory in /home/content/24/4682424/html/westfamilyblog/wp-includes/functions.php on line 4463

Warning: fread() expects parameter 1 to be resource, boolean given in /home/content/24/4682424/html/westfamilyblog/wp-includes/functions.php on line 4466

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/content/24/4682424/html/westfamilyblog/wp-includes/functions.php on line 4469

The offending code appears to be:

    $plugin_path = WP_PLUGIN_DIR . '/wp-cldr/wp-cldr.php';
    $plugin_info = get_plugin_data( $plugin_path );

I haven't been able to reproduce on other sites yet, and it worked fine before I did the uninstall/reinstall.

jblz commented 8 years ago

Try using basename( __DIR__ ) instead of WP_PLUGIN_DIR

stuwest commented 8 years ago

hahah. it's so tempting to blame GoDaddy or PHP 5.4 but unfortunately in this case PEBKAC.

I was compressing the plugin already in a folder. Looks like core uses the zip archive name for the folder name so the plugin i uploaded was nested one level too deep. As a result, WP_PLUGIN_DIR . '/wp-cldr/wp-cldr.php'; failed because the plugin file was actually located in 'wp-cldr-29.0.0/wp-cldr/wp-cldr.php'. Duh.