Skip to content

Commit

Permalink
Strict comparission on CConsoleCommand::prompt.
Browse files Browse the repository at this point in the history
This avoid the return of default value when user writes '0'.
  • Loading branch information
dnohales committed Mar 7, 2012
1 parent 42ff7a2 commit 95ff55d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/console/CConsoleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function pluralize($name)
*
* @param string $message to echo out before waiting for user input
* @param string $default the default string to be returned when user does not write anything.
* Defaults to null. This parameter is available since version 1.1.11.
* Defaults to null, means that default string is disabled. This parameter is available since version 1.1.11.
* @return mixed line read as a string, or false if input has been closed
*
* @since 1.1.9
Expand Down Expand Up @@ -534,7 +534,7 @@ public function prompt($message,$default=null)
return false;
else{
$input=trim($input);
return (empty($input) && $default!==null) ? $default : $input;
return ($input==='' && $default!==null) ? $default : $input;
}
}

Expand Down

0 comments on commit 95ff55d

Please sign in to comment.