wecodemore / wpstarter

Easily bootstrap whole site Composer packages for WordPress.
https://wecodemore.github.io/wpstarter/
MIT License
246 stars 35 forks source link

wpstarter-mu-loader fails on file loading #77

Closed Chrico closed 6 years ago

Chrico commented 6 years ago

Describe the bug I have a normal WP Starter 3 setup and a mu-plugin which is loaded via composer.json ( https://github.com/inpsyde/WP-Stash ).

The WP Starter 3 Script generates following wpstarter-mu-loader.php:

<?php declare(strict_types=1);
/**
 * Plugin Name: WP Starter MU plugins loader.
 * Description: MU plugins loaded: wp-stash/wp-stash.php.
 */

foreach (explode(',', 'wp-stash/wp-stash.php') as $muPlugin) {
    $filePath = wp_normalize_path(__DIR__ . '/'. trim($muPlugin));
    // Skip unexistent, unreadable and non-php files
    if ($filePath
        && is_file($filePath)
        && is_readable($filePath)
        && strtolower(pathinfo($filePath, PATHINFO_EXTENSION)) === 'php'
        && validate_file($filePath) === 0
    ) {
        require_once $filePath;
    }
}

Sadly the validate_file_check() fails, because it returns 2. I guess the if-check should be !== 0 to ensure that the file is "okay".


To Reproduce

  1. Normal WP Starter 3 Setup
  2. Use a MU-Plugin loaded via composer.json - https://github.com/inpsyde/WP-Stash
  3. Run composer install

Expected behavior The check shouldn't fail for valid files ;-)

System (please complete the following information):

gmazzap commented 6 years ago

validate_file return 0 when everything is fine.

The problem is that it fails for absolute paths. I'll fix.

gmazzap commented 6 years ago

@Chrico can you please test last commit?

Chrico commented 6 years ago

works now. Thanks 👍