Open mofashi998 opened 2 years ago
我暂时的解决方法 is_countable($body) 新增这一句
// append body $data .= "\n\n"; if ( is_countable($body) && count($body) > 0 && isset($headers["Content-Type"]) && $headers["Content-Type"] != "application/octet-stream" ) { $data .= $body; }
Laravel9 PHP8 无法上传图片
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in file D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Auth.php on line 117
`0 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Auth.php(117): count(NULL)
1 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Auth.php(227): Qiniu\Auth->signQiniuAuthorization('http://rs.qiniu...', 'GET', NULL, Object(Qiniu\Http\Header))
2 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Storage\BucketManager.php(959): Qiniu\Auth->authorizationV2('http://rs.qiniu...', 'GET', NULL, 'application/x-w...')
3 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Storage\BucketManager.php(954): Qiniu\Storage\BucketManager->getV2('http://rs.qiniu...')
4 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\qiniu\php-sdk\src\Qiniu\Storage\BucketManager.php(578): Qiniu\Storage\BucketManager->rsGet('/stat/ZGRzdWppZ...')
5 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\zgldh\qiniu-laravel-storage\src\QiniuAdapter.php(263): Qiniu\Storage\BucketManager->stat('ddsujie', 'images/3ad8320c...')
6 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\zgldh\qiniu-laravel-storage\src\QiniuAdapter.php(708): zgldh\QiniuStorage\QiniuAdapter->getMetadata('images/3ad8320c...')
7 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\league\flysystem\src\Filesystem.php(48): zgldh\QiniuStorage\QiniuAdapter->fileExists('images/3ad8320c...')
8 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemAdapter.php(159): League\Flysystem\Filesystem->has('images/3ad8320c...')
9 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Form\Field\UploadField.php(101): Illuminate\Filesystem\FilesystemAdapter->exists('images/3ad8320c...')
10 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Form\Field\UploadField.php(197): Dcat\Admin\Form\Field\File->renameIfExists(Object(Illuminate\Http\UploadedFile))
11 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Form\Concerns\HasFiles.php(50): Dcat\Admin\Form\Field\File->upload(Object(Illuminate\Http\UploadedFile))
12 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Form.php(685): Dcat\Admin\Form->handleUploadFile(Array)
13 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Form.php(621): Dcat\Admin\Form->beforeStore(Array)
14 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Controllers\AdminController.php(146): Dcat\Admin\Form->store()
15 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): Dcat\Admin\Http\Controllers\AdminController->store()
16 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('store', Array)
17 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Route.php(261): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Admin\Controllers\AppServiceController), 'store')
18 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Route.php(204): Illuminate\Routing\Route->runController()
19 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php(725): Illuminate\Routing\Route->run()
20 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
21 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\WebUploader.php(31): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
22 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\WebUploader->handle(Object(Illuminate\Http\Request), Object(Closure))
23 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Session.php(12): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
24 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Session->handle(Object(Illuminate\Http\Request), Object(Closure))
25 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Permission.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
26 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Permission->handle(Object(Illuminate\Http\Request), Object(Closure))
27 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Bootstrap.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
28 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Bootstrap->handle(Object(Illuminate\Http\Request), Object(Closure))
29 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Pjax.php(22): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
30 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Pjax->handle(Object(Illuminate\Http\Request), Object(Closure))
31 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Authenticate.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
32 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
33 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
34 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
35 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
36 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
37 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
38 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
39 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
40 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
41 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
42 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
43 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
44 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
45 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
46 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\dcat\laravel-admin\src\Http\Middleware\Application.php(15): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
47 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Dcat\Admin\Http\Middleware\Application->handle(Object(Illuminate\Http\Request), Object(Closure), 'admin')
48 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
49 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php(727): Illuminate\Pipeline\Pipeline->then(Object(Closure))
50 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php(702): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
51 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php(666): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
52 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Routing\Router.php(655): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
53 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(167): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
54 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
55 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
56 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
57 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))
58 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
59 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
60 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))
61 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
62 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
63 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
64 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
65 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Http\Middleware\HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
66 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
67 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Http\Middleware\TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
68 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
69 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
70 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(142): Illuminate\Pipeline\Pipeline->then(Object(Closure))
71 D:\phpstudy_pro\WWW\laravel9.dd.com\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
72 D:\phpstudy_pro\WWW\laravel9.dd.com\public\index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
73 {main}
`