PHP / Phalcon错误:已关闭,未发送请求;它可能只是一个未使用的推测性预连接

问题描述 投票:0回答:1

我有一个基本的控制器操作:

    public function createAction() {
        $this->view->disable();

        $formData = $this->request->getJsonRawBody();

        $user = new Users();

        $user->first_name = $formData->first_name;
        $user->last_name = $formData->last_name;
        $user->email_address = $formData->email_address;
        $user->password = $formData->password;

        // this prints to my debug log.
        $result = $user->save(); 
        AppLogger::$logger->debug(print_r($result, true)); // this does not print.
        AppLogger::$logger->debug("oh boy #2"); // this does not print either.
        // which seems to tell me that the line above it is problematic,
        // but there is no error output from `phalcon serve`

        echo Json::encode($result);
    }

我看到的最接近错误的是:PHP/Phalcon Error: Closed without sending a request; it was probably just an unused speculative preconnection。它出现在phalcon serve的输出中。

我正在Windows的VSCode中运行phalcon serve

php phalcon
1个回答
0
投票

我通过将$result = $user->save();包装在try / catch中来解决此问题,然后我看到了异常。

似乎此异常不会自动显示在终端输出中...

© www.soinside.com 2019 - 2024. All rights reserved.