在 CakePHP 中的类型推断期间发生缩小
Narrowing occurred during type inference in CakePHP
我的蛋糕PHP版本:2.8.4
PHP: 7.1.12 (FastCGI)
我刚注意到错误日志中全是这样的:
2018-01-07 09:05:33 Warning: Warning (2): Narrowing occurred during type inference. Please file a bug report on bugs.php.net in [/var/www/******/httpdocs/lib/Cake/Core/App.php, line 547]
Trace:
include - CORE/Cake/Core/App.php, line 547
App::load() - CORE/Cake/Core/App.php, line 547
spl_autoload_call - [internal], line ??
TranslateBehavior::_getLocale() - CORE/Cake/Model/Behavior/TranslateBehavior.php, line 534
TranslateBehavior::beforeFind() - CORE/Cake/Model/Behavior/TranslateBehavior.php, line 104
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 128
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 243
Model::buildQuery() - CORE/Cake/Model/Model.php, line 3084
Model::find() - CORE/Cake/Model/Model.php, line 2998
DboSource::query() - CORE/Cake/Model/Datasource/DboSource.php, line 595
Model::__call() - CORE/Cake/Model/Model.php, line 827
GalleryPicturesController::getPicture() - APP/Controller/GalleryPicturesController.php, line 35
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 110
有很多这样的错误。
不只是关于 GalleryPicturesController.php,而是总是指 "Cake/Core/App.php, line 547"。
Cake/Core/App.php,第 547 行:
错误的原因是什么?
更新
解决方案:
class AppModel extends Model
{
public $locale = 'hun';//I just added it
但现在:
2018-01-07 11:27:20 Warning: Warning (2): Narrowing occurred during type inference. Please file a bug report on bugs.php.net in [/var/www/******/httpdocs/lib/Cake/Core/App.php, line 547]
Trace:
include - CORE/Cake/Core/App.php, line 547
App::load() - CORE/Cake/Core/App.php, line 547
spl_autoload_call - [internal], line ??
__ - CORE/Cake/basics.php, line 587
include - APP/View/GalleryPictures/open.ctp, line 64
View::_evaluate() - CORE/Cake/View/View.php, line 971
View::_render() - CORE/Cake/View/View.php, line 933
View::render() - CORE/Cake/View/View.php, line 473
Controller::render() - CORE/Cake/Controller/Controller.php, line 963
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 200
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 110
在:GalleryPictures/open.ctp,第 64 行:
<th><?php echo(__('Feltöltő')); ?></th>
正如评论中已经提到的,这是 PHP 中的一个错误,而您正在使用显然引入该错误的 PHP 版本,即 7.1.12,请参阅相关错误报告:
该错误已在 PHP 7.1.13 and 7.2.1, so I'd suggest that you upgrade your PHP installation, or if you cannot upgrade (or downgrade for that matter), try disabling opcode caching 中修复,这似乎是该错误的来源。
如果升级不能解决问题,请在 https://bugs.php.net
报告
我的蛋糕PHP版本:2.8.4 PHP: 7.1.12 (FastCGI)
我刚注意到错误日志中全是这样的:
2018-01-07 09:05:33 Warning: Warning (2): Narrowing occurred during type inference. Please file a bug report on bugs.php.net in [/var/www/******/httpdocs/lib/Cake/Core/App.php, line 547]
Trace:
include - CORE/Cake/Core/App.php, line 547
App::load() - CORE/Cake/Core/App.php, line 547
spl_autoload_call - [internal], line ??
TranslateBehavior::_getLocale() - CORE/Cake/Model/Behavior/TranslateBehavior.php, line 534
TranslateBehavior::beforeFind() - CORE/Cake/Model/Behavior/TranslateBehavior.php, line 104
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 128
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 243
Model::buildQuery() - CORE/Cake/Model/Model.php, line 3084
Model::find() - CORE/Cake/Model/Model.php, line 2998
DboSource::query() - CORE/Cake/Model/Datasource/DboSource.php, line 595
Model::__call() - CORE/Cake/Model/Model.php, line 827
GalleryPicturesController::getPicture() - APP/Controller/GalleryPicturesController.php, line 35
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 110
有很多这样的错误。
不只是关于 GalleryPicturesController.php,而是总是指 "Cake/Core/App.php, line 547"。
Cake/Core/App.php,第 547 行:
错误的原因是什么?
更新
解决方案:
class AppModel extends Model
{
public $locale = 'hun';//I just added it
但现在:
2018-01-07 11:27:20 Warning: Warning (2): Narrowing occurred during type inference. Please file a bug report on bugs.php.net in [/var/www/******/httpdocs/lib/Cake/Core/App.php, line 547]
Trace:
include - CORE/Cake/Core/App.php, line 547
App::load() - CORE/Cake/Core/App.php, line 547
spl_autoload_call - [internal], line ??
__ - CORE/Cake/basics.php, line 587
include - APP/View/GalleryPictures/open.ctp, line 64
View::_evaluate() - CORE/Cake/View/View.php, line 971
View::_render() - CORE/Cake/View/View.php, line 933
View::render() - CORE/Cake/View/View.php, line 473
Controller::render() - CORE/Cake/Controller/Controller.php, line 963
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 200
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 110
在:GalleryPictures/open.ctp,第 64 行:
<th><?php echo(__('Feltöltő')); ?></th>
正如评论中已经提到的,这是 PHP 中的一个错误,而您正在使用显然引入该错误的 PHP 版本,即 7.1.12,请参阅相关错误报告:
该错误已在 PHP 7.1.13 and 7.2.1, so I'd suggest that you upgrade your PHP installation, or if you cannot upgrade (or downgrade for that matter), try disabling opcode caching 中修复,这似乎是该错误的来源。
如果升级不能解决问题,请在 https://bugs.php.net
报告