diff --git a/src/Console/Command.php b/src/Console/Command.php
index <HASH>..<HASH> 100644
--- a/src/Console/Command.php
+++ b/src/Console/Command.php
@@ -77,7 +77,7 @@ class Command
      */
     public function setName($name)
     {
-        if (strpos($name, ' ') === false) {
+        if (strpos($name, ' ') < 1) {
             throw new InvalidArgumentException(
                 "The name '{$name}' is missing a space. Names should look like `cake routes`"
             );
diff --git a/tests/TestCase/Console/CommandTest.php b/tests/TestCase/Console/CommandTest.php
index <HASH>..<HASH> 100644
--- a/tests/TestCase/Console/CommandTest.php
+++ b/tests/TestCase/Console/CommandTest.php
@@ -78,6 +78,18 @@ class CommandTest extends TestCase
     }
 
     /**
+     * Test invalid name
+     *
+     * @expectedException InvalidArgumentException
+     * @return void
+     */
+    public function testSetNameInvalidLeadingSpace()
+    {
+        $command = new Command();
+        $command->setName(' routes_show');
+    }
+
+    /**
      * Test option parser fetching
      *
      * @return void
Names starting with spaces are invalid.