Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


CConsoleCommand: Array to string conversion when displaying help #1996

dInGd0nG opened this Issue · 6 comments

3 participants


Below command uses anonymous arguments as specified in the definitive guide.

class TestCommand extends CConsoleCommand
    public function actionIndex($limit=10, $args=array())

So when I call the help for this test command
php yiic help test

PHP Error[8]: Array to string conversion
    in file /var/www/yii/framework/console/CConsoleCommand.php at line 313

I think you should add array hint in front of $args. Also is there the same error if you're not using print_r?


I used exactly as said in the definitive guide. the problem is ther without print_r . this line is causing problems as the $defaultValue is an array()

Anonymous action parameters wont work if i use an arry hinting


Ahh, I see. Yes, that seems to be a bug. You must be used very recent PHP versions.

@samdark samdark was assigned

hm... afaik you have to put $args as first param, but didn't check that.

@dInGd0nG dInGd0nG referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.

@dInGd0nG can you send a pull-request?

@samdark samdark closed this issue from a commit
@samdark samdark Fixed #1996: Using yiic help for commands with parameters with array …
…as default value resulted in PHP error with latest PHP versions
@samdark samdark closed this in 0dbccc4

Merged manually with some adjustments. Thanks for working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.