OSDN Git Service

avoid leaking private \WP_CLI\Runner properties and methods
authorscribu <mail@scribu.net>
Thu, 21 Nov 2013 09:12:44 +0000 (11:12 +0200)
committerscribu <mail@scribu.net>
Thu, 21 Nov 2013 09:12:44 +0000 (11:12 +0200)
php/WP_CLI/Runner.php
php/utils.php

index e09a54a..1782695 100644 (file)
@@ -450,7 +450,7 @@ class Runner {
 
                if ( isset( $this->config['require'] ) ) {
                        foreach ( $this->config['require'] as $path ) {
-                               require $path;
+                               Utils\load_file( $path );
                        }
                }
 
index d1713b5..64a165f 100644 (file)
@@ -36,6 +36,11 @@ function get_vendor_paths() {
        );
 }
 
+// Using require() directly inside a class grants access to private methods to the loaded code
+function load_file( $path ) {
+       require $path;
+}
+
 function load_command( $name ) {
        $path = WP_CLI_ROOT . "/php/commands/$name.php";