Browse Source

ConsoleOptionParser::_parseOption() tramples option values of 0 (zero). I believe the following condition is the culprit.

Simon Males 13 years ago
parent
commit
80773ad970
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/Cake/Console/ConsoleOptionParser.php

+ 2 - 1
lib/Cake/Console/ConsoleOptionParser.php

@@ -585,7 +585,8 @@ class ConsoleOptionParser {
 		$option = $this->_options[$name];
 		$isBoolean = $option->isBoolean();
 		$nextValue = $this->_nextToken();
-		if (!$isBoolean && !empty($nextValue) && !$this->_optionExists($nextValue)) {
+		$emptyNextValue = (empty($nextValue) && $nextValue != 0);
+		if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
 			array_shift($this->_tokens);
 			$value = $nextValue;
 		} elseif ($isBoolean) {