From 83d9a3b370e9449b406c952255d0e20216cfa9cd Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Fri, 8 Sep 2017 14:20:12 -0700
Subject: [PATCH] Bug fixes for 3658a3c

---
 includes/functions.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/includes/functions.php b/includes/functions.php
index da0ed95..94c175b 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -30,10 +30,12 @@ function schedule_cli_command( $command, $timestamp = null ) {
 /**
  * Validate WP-CLI command to be scheduled
  *
- * @param string $args
+ * @param string $command
  * @return array|\WP_Error
  */
 function validate_command( $command ) {
+	$command = trim( $command );
+
 	// Strip `wp` if included
 	if ( 0 === stripos( $command, 'wp' ) ) {
 		$command = trim( substr( $command, 2 ) );
@@ -48,7 +50,7 @@ function validate_command( $command ) {
 
 	// Don't worry about the user WP-CLI runs as
 	if ( false === stripos( $command, '--allow-root' ) ) {
-		$args .= ' --allow-root';
+		$command .= ' --allow-root';
 	}
 
 	// TODO: validate further
-- 
GitLab