windows下部署的workerman项目不固定报下面的错误,请大神帮助

bifnwfn88
#31 E:\www\\sioserver.php(12): require('E:\\www\\...')
#32 {main}think\exception\ErrorException: Creating default object from empty val
ue in E:\www\\vendor\workerman\phpsocket.io\src\Engine\Protocols\Http
\Response.php:153
Stack trace:
#0 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Protocols\Http\Re
sponse.php(153): think\Error::appError(2, 'Creating defaul...', 'E:\\www\\zhibo0
7y...', 153, Array)
#1 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Protocols\Http\Re
sponse.php(143): PHPSocketIO\Engine\Protocols\Http\Response->destroy()
#2 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Pollin
gXHR.php(47): PHPSocketIO\Engine\Protocols\Http\Response->end('\x00\x01\x00\x01\
xFF0{"sid":"d...')
#3 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Pollin
g.php(181): PHPSocketIO\Engine\Transports\PollingXHR->doWrite('\x00\x01\x00\x01\
xFF0{"sid":"d...')
#4 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Pollin
g.php(176): PHPSocketIO\Engine\Transports\Polling->write('\x00\x01\x00\x01\xFF0{
"sid":"d...')
#5 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Socket.php(318):
PHPSocketIO\Engine\Transports\Polling->send(Array)
#6 : PHPSocketIO\Engine\Socket->flush()
#7 E:\www\\vendor\workerman\phpsocket.io\src\Event\Emitter.php(91): c
all_user_func_array(Array, Array)
#8 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Pollin
g.php(50): PHPSocketIO\Event\Emitter->emit('drain')
#9 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Pollin
g.php(18): PHPSocketIO\Engine\Transports\Polling->onPollRequest(Object(PHPSocket
IO\Engine\Protocols\Http\Request), Object(PHPSocketIO\Engine\Protocols\Http\Resp
onse))
#10 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Transports\Polli
ngXHR.php(28): PHPSocketIO\Engine\Transports\Polling->onRequest(Object(PHPSocket
IO\Engine\Protocols\Http\Request))
#11 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Engine.php(212):
 PHPSocketIO\Engine\Transports\PollingXHR->onRequest(Object(PHPSocketIO\Engine\P
rotocols\Http\Request))
#12 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Engine.php(84):
PHPSocketIO\Engine\Engine->handshake(Object(PHPSocketIO\Engine\Transports\Pollin
gXHR), Object(PHPSocketIO\Engine\Protocols\Http\Request))
#13 : PHPSocketIO\Engine\Engine->dealRequest(NULL, true, Obje
ct(PHPSocketIO\Engine\Protocols\Http\Request))
#14 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Engine.php(142):
 call_user_func(Array, NULL, true, Object(PHPSocketIO\Engine\Protocols\Http\Requ
est))
#15 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Engine.php(133):
 PHPSocketIO\Engine\Engine->checkRequest(Object(PHPSocketIO\Engine\Protocols\Htt
p\Request), Array)
#16 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Engine.php(67):
PHPSocketIO\Engine\Engine->verify(Object(PHPSocketIO\Engine\Protocols\Http\Reque
st), Object(PHPSocketIO\Engine\Protocols\Http\Response), false, Array)
#17 : PHPSocketIO\Engine\Engine->handleRequest(Object(PHPSock
etIO\Engine\Protocols\Http\Request), Object(PHPSocketIO\Engine\Protocols\Http\Re
sponse))
#18 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Protocols\Socket
IO.php(97): call_user_func(Array, Object(PHPSocketIO\Engine\Protocols\Http\Reque
st), Object(PHPSocketIO\Engine\Protocols\Http\Response))
#19 E:\www\\vendor\workerman\phpsocket.io\src\Engine\Protocols\Socket
IO.php(45): PHPSocketIO\Engine\Protocols\SocketIO::emitRequest(Object(Workerman\
Connection\TcpConnection), Object(PHPSocketIO\Engine\Protocols\Http\Request), Ob
ject(PHPSocketIO\Engine\Protocols\Http\Response))
#20 E:\www\\vendor\workerman\workerman\Connection\TcpConnection.php(4
44): PHPSocketIO\Engine\Protocols\SocketIO::input('GET /socket.io/...', Object(W
orkerman\Connection\TcpConnection))
#21 : Workerman\Connection\TcpConnection->baseRead(Resource i
d #17146)
#22 E:\www\\vendor\workerman\workerman\Events\Select.php(257): call_u
ser_func_array(Array, Array)
#23 E:\www\\vendor\workerman\workerman\Worker.php(808): Workerman\Eve
nts\Select->loop()
#24 E:\www\\vendor\workerman\workerman\Worker.php(457): Workerman\Wor
ker->run()
#25 E:\www\\vendor\workerman\workerman\Worker.php(366): Workerman\Wor
ker::runAllWorkers()
#26 E:\www\\app\core\controller\Sio.php(115): Workerman\Worker::runAl
l()
#27 E:\www\\thinkphp\library\think\Loader.php(409): app\core\controll
er\Sio->__construct(Object(think\Request))
#28 E:\www\\thinkphp\library\think\App.php(334): think\Loader::contro
ller('sio', 'controller', false, 'Error')
#29 E:\www\\thinkphp\library\think\App.php(133): think\App::module(Ar
ray, Array, true)
#30 E:\www\\thinkphp\start.php(18): think\App::run()
#31 E:\www\\sioserver.php(12): require('E:\\www\\...')
#32 {main}
3798 3 0
3个回答

phpcreeper

看上去这个错误是由于 $this->_connection对象为空引起的,E:\www\vendor\workerman\phpsocket.io\src\Engine\Protocols\Http \Response.php:153 行这样判断更好:

if(!empty($this->_connection))
{
    $this->_connection->httpResponse = $this->_connection->httpRequest = null;
}

【源码还得看 walkor 老大怎么说吧】

  • 暂无评论
walkor 打赏

已经加了判断,感谢反馈

  • 暂无评论
bifnwfn88

先谢谢大神的指点,我的项目里确实没有这断代码。

public function destroy()
    {
        if(!empty($this->_connection->httpRequest))
        {
            $this->_connection->httpRequest->destroy();
        }
        if(!empty($this->_connection))
        {
        $this->_connection->httpResponse = $this->_connection->httpRequest = null;
        }
        $this->_connection = null;
        $this->writable = false;
    }

加完之后是这样的。看看是否还有问题。万分感谢。!!!!!

  • 暂无评论
年代过于久远,无法发表回答
×
🔝