Yii2: Console application: Negative integer parameter causes "Unknown alias" error

Created on 1 Dec 2016  路  4Comments  路  Source: yiisoft/yii2

What steps will reproduce the problem?

Create console controller with an action which has one required parameter:

public function actionSend($chatId)
{
    $result = \Longman\TelegramBot\Request::sendMessage([
        'chat_id'   => $chatId,
        'text'      => 'some text',
    ]);
}

Than run this command with negative chatId:

yii messenger/send -12345

What is the expected result?

Expected result is running actionSend() with $chatId equals to -12345

What do you get instead?

You'll get Error: Unknown alias: -12345

Additional info

| Q | A
| ---------------- | ---
| Yii version | 2.0.10
| PHP version | 7.0.13
| Operating system | Ubuntu 16.0.4

bug

Most helpful comment

@klimov-paul the same. quotes are interpreted at bash level.

All 4 comments

What will happen if you wrap your value in quotes:

yii messenger/send '-12345'

?

@klimov-paul the same. quotes are interpreted at bash level.

@cebe @uaoleg check my pull request https://github.com/yiisoft/yii2/pull/13220 please.

@cebe can you set this issue to 2.0.11 version?

Was this page helpful?
0 / 5 - 0 ratings