webman 七牛上传图片 一直失败worker restart
2022-04-05 12:43:59 pid:1 Worker process terminated with ERROR: E_ERROR "During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Qiniu\Http\Header::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php:114
Stack trace:
#0 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php(8): {closure}(8192, 'Return type of ...', 'D:\\laragon\\www\\...', 114)
#1 D:\laragon\www\dev\vendor\composer\ClassLoader.php(571): include('D:\\laragon\\www\\...')
#2 D:\laragon\www\dev\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('D:\\laragon\\www\\...')
#3 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Client.php(128): Composer\Autoload\ClassLoader->loadClass('Qiniu\\Http\\Head...')
#4 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Client.php(13): Qiniu\Http\Client::sendRequest(Object(Qiniu\Http\Request))
#5 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Region.php(147): Qiniu\Http\Client::get('api.qiniu.com/v...')
#6 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Zone.php(45): Qiniu\Region::queryRegion('qxM_haL4C7EoaG_...', 'woisks')
#7 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Config.php(135): Qiniu\Zone::queryZone('qxM_haL4C7EoaG_...', 'woisks')
#8 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Config.php(41): Qiniu\Config->getRegion('qxM_haL4C7EoaG_...', 'woisks')
#9 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Storage\FormUploader.php(61): Qiniu\Config->getUpHost('qxM_haL4C7EoaG_...', 'woisks')
#10 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Storage\UploadManager.php(116): Qiniu\Storage\FormUploader::put('qxM_haL4C7EoaG_...', 'avatar', '\xFF\xD8\xFF\xE0\x00\x10JFIF\x00\x01\x01\x00\x00...', Object(Qiniu\Config), NULL, 'application/oct...', 'wor9AC9.tmp')
#11 D:\laragon\www\dev\app\passport\controller\State.php(42): Qiniu\Storage\UploadManager->putFile('qxM_haL4C7EoaG_...', 'avatar', Object(Webman\Http\UploadFile))
#12 D:\laragon\www\dev\framework-webman\App.php(331): app\passport\controller\State->online(Object(Webman\Http\Request))
#13 D:\laragon\www\dev\framework-webman\App.php(146): Webman\App::findRoute(Object(Workerman\Connection\TcpConnection), '/passport/onlin...', 'POST/passport/o...', Object(Webman\Http\Request))
#14 D:\laragon\www\dev\vendor\workerman\workerman\Connection\TcpConnection.php(638): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(Webman\Http\Request))
#15 D:\laragon\www\dev\vendor\workerman\workerman\Events\Select.php(295): Workerman\Connection\TcpConnection->baseRead(Resource id #196)
#16 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(2431): Workerman\Events\Select->loop()
#17 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(1430): Workerman\Worker->run()
#18 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(1373): Workerman\Worker::forkWorkersForWindows()
#19 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(549): Workerman\Worker::forkWorkers()
#20 D:\laragon\www\dev\start.php(94): Workerman\Worker::runAll()
#21 {main} in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php on line 8"
2个回答
年代过于久远,无法发表回答
php 8.1.3
看起来是七牛SDK不支持PHP8.1
这个错误是 workerman log 记录的,上传失败,直接workerman 抛出错误,start.php terminated and try to restart
win 环境下重新 composer create-project workerman/webman 拉取几次安装七牛的SDK,都是这个错误
Worker process terminated with ERROR: E_ERROR "During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Qiniu\Http\Header::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php:114
七牛SDK不支持PHP8.1导致的,不是workerman或者webman的问题
ok,是的,我反复测试,把php换到7.4的正常可以使用、感谢!!!