composer create-project yiisoft/yii2-app-basic app
搜索__destruct
和__wakeup
grep -A 10 -rn "__destruct"
yii\db\BatchQueryResult
:
這里調用了close,搜索close發現
yii\web\DbSession
類中的close
:
而這里又調用了getIsActive
public function getIsActive()
{
return session_status() === PHP_SESSION_ACTIVE;
}
yii2中的debug和gii這兩個默認擴展都存在(不一定要開啟)時,這里session_status()返回true
yii\web\MultiFieldSession
的composeFields
:
call_user_func
可控
而yii\rest\IndexAction
中的run
public function run()
{
if ($this->checkAccess) {
call_user_func($this->checkAccess, $this->id);
}
return $this->prepareDataProvider();
}
其中call_user_func
兩個可控參數,可以構造傳入對象作參數形式,例子:[(new test), "aaa"]
,調用其中的aaa
方法.