From 7fc1f2cd2b6e6e4675d2b264750f15fca897923c Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Thu, 28 Sep 2017 19:54:37 -0700 Subject: [PATCH] Block recursive scheduling, no one really likes infinite loops --- includes/functions.php | 5 +++++ tests/tests/class-plugin-functions.php | 1 + 2 files changed, 6 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 6ae758f..9138fbc 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -75,6 +75,11 @@ function validate_command( $command ) { * @return bool */ function is_command_allowed( $command ) { + // No recursion allowed. + if ( CLI_NAMESPACE === $command ) { + return false; + } + // Command explicitly disallowed. if ( in_array( $command, get_command_blacklist(), true ) ) { return false; diff --git a/tests/tests/class-plugin-functions.php b/tests/tests/class-plugin-functions.php index 2845bbc..fe035e0 100644 --- a/tests/tests/class-plugin-functions.php +++ b/tests/tests/class-plugin-functions.php @@ -128,6 +128,7 @@ class Plugin_Functions extends WP_UnitTestCase { array( 'wp cli info' ), // Should fail, is a blocked event. array( 'wp cli info' ), // Should fail as a blocked event, would otherwise fail as a duplicate. array( 'cli info' ), // Should also fail as a blocked event, though normalization would also block it as a duplicate. + array( sprintf( '%s create', WP_CLI_Cron_Control_Offload\CLI_NAMESPACE ) ), // Don't permit recursive scheduling. ); } -- GitLab