简体   繁体   中英

Narrowing occurred during type inference in CakePHP

My CakePHP Version: 2.8.4 PHP: 7.1.12 (FastCGI)

I just noticed that the error log is full of this:

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

There are plenty of such an error.

Not just about GalleryPicturesController.php, but always refers to "Cake/Core/App.php, line 547".

Cake/Core/App.php, line 547: 在此处输入图片说明

What can be the cause of the error?


UPDATE


Solution:

class AppModel extends Model
    {
    public $locale = 'hun';//I just added it

But now:

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

In: GalleryPictures/open.ctp, line 64:

<th><?php echo(__('Feltöltő')); ?></th>

As already mentioned in the comments, that is a bug in PHP, and you are using the PHP version where that bug apparently was introduced, that is 7.1.12, see the related bug reports:

The bug was fixed in in 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 , which is where this bug seems to stem from.

If upgrading doesn't fix the problem, report it over at https://bugs.php.net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM