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
方法.