1

我的 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 行”。

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>
4

1 回答 1

2

正如评论中已经提到的,这是 PHP 中的一个错误,并且您正在使用明显引入该错误的 PHP 版本,即 7.1.12,请参阅相关的错误报告:

该错误已在 PHP 7.1.137.2.1中修复,因此我建议您升级您的 PHP 安装,或者如果您无法升级(或降级),请尝试禁用操作码缓存,这就是这个错误似乎源于。

如果升级不能解决问题,请在https://bugs.php.net上报告

于 2018-01-07T16:36:58.867 回答