yiisoft/yii — pull request #2580 by creocoder (2013-06-24 10:36:41+00:00)
Title: CApplication allow successfully use $this inside config file

Compare this `config/main.php`:

```php
$request = Yii::createComponent(array('class' => 'CHttpRequest'));

return array(
...
'components' => array(
...
'thumbnail' => array(
'class' => 'Thumbnail',
'basePath' => dirname(dirname($request->scriptFile)) . DIRECTORY_SEPARATOR . 'thumbs',
'baseUrl' => dirname($request->baseUrl) . '/thumbs',
'uploadPath' => dirname(dirname($request->scriptFile)) . DIRECTORY_SEPARATOR . 'uploads',
'uploadUrl' => dirname($request->baseUrl) . '/uploads',
),
...
),
...
);
```

And this `config/main.php`:

```php
return array(
...
'components' => array(
...
'thumbnail' => array(
'class' => 'Thumbnail',
'basePath' => dirname(dirname($this->request->scriptFile)) . DIRECTORY_SEPARATOR . 'thumbs',
'baseUrl' => dirname($this->request->baseUrl) . '/thumbs',
'uploadPath' => dirname(dirname($this->request->scriptFile)) . DIRECTORY_SEPARATOR . 'uploads',
'uploadUrl' => dirname($this->request->baseUrl) . '/uploads',
),
...
),
...
);
```

This change allow use core components in config file without use `Yii::createComponent()` hack.

@quiangxue

>// set basePath at early as possible to avoid trouble

There is no any troubles to set basePath a little later ;)