我有一個名爲FilterInput
的PHP類。當我的基於Symfony(3.0.3)的應用程序調用FilterInput
的靜態成員函數時,將隱式調用Symfony的DebugClassLoader
。該方法被稱爲loadClass
並開始像這樣:symfony 3應用程序無法默默地在DebugClassLoader中require_once
public function loadClass($class)
{
ErrorHandler::stackErrors();
try {
if ($this->isFinder) {
if ($file = $this->classLoader[0]->findFile($class)) {
require_once $file;
}
} else {
call_user_func($this->classLoader, $class);
$file = false;
}
} finally {
ErrorHandler::unstackErrors();
}
...
我觀察的問題是,當執行到達include_once
指令,應用程序就會失敗。也就是說,http請求返回空,並且在dev.log
或我的apache日誌中沒有輸出。我已驗證$file
變量包含完整且正確的/path/to/FilterInput.php
。我也驗證過這個文件是可讀的。所以我的問題是:
- 爲什麼執行停止在這一點?
- 它爲什麼會在沒有日誌錯誤消息或響應中返回數據的情況下失敗。
編輯:進一步的信息:如果我填寫垃圾路徑,例如, 「/ foo/bar」然後我得到一個錯誤信息Compile Error: AppBundle\Components\Factory::getDBO(): Failed opening required '/foo/bar' (include_path='.:')
;所以大概無聲的失敗與某個事實有關,是在給定路徑的文件。
您確定處於開發模式?在你的app.php中,確保你像下面這樣實例化你的AppKernel:'$ kernel = new AppKernel('dev',true);' –
幫助我找到了很多先前忽略的錯誤 - 但我仍然**無聲**在require_once上失敗 – Black