我的CakePHP版本: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,第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>
答案 0 :(得分:1)
正如评论中已经提到的,这是PHP中的一个错误,并且您正在使用PHP版本,其中显然引入了该错误,即7.1.12,请参阅相关的错误报告:
错误已在PHP 7.1.13和7.2.1中修复,因此我建议您升级PHP安装,或者如果您无法升级(或降级),请尝试禁用opcode caching,这就是这个bug似乎源自的地方。
如果升级无法解决问题,请在 https://bugs.php.net
报告