Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

so many deprecated after updating 3.4.13 to 3.6 cakephp

s0o many deprecated error?

How to fixed this one?

Deprecated (16384): CakeCacheCache::config() is deprecated. Use setConfig()/getConfig() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 136 [COREsrcCorefunctions.php, line 305] Deprecated (16384): CakeDatasourceConnectionManager::config() is deprecated. Use setConfig()/getConfig() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 137 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Use CakeMailerEmail instead of CakeNetworkEmailEmail. - E:xampphtdocscakephpvendorcomposerClassLoader.php, line: 444 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Email::configTransport() is deprecated. Use Email::setConfigTransport() or Email::getConfigTransport() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 138 [COREsrcCorefunctions.php, line 305] Deprecated (16384): CakeMailerEmail::config() is deprecated. Use setConfig()/getConfig() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 139 [COREsrcCorefunctions.php, line 305] Deprecated (16384): CakeLogLog::config() is deprecated. Use setConfig()/getConfig() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 140 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Security::salt() is deprecated. Use Security::getSalt()/setSalt() instead. - E:xampphtdocscakephpconfigootstrap.php, line: 141 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Use CakeHttpServerRequest instead of CakeNetworkRequest. - E:xampphtdocscakephpvendorcomposerClassLoader.php, line: 444 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ServerRequest::createFromGlobals() is deprecated. Use CakeHttpServerRequestFactory instead. - E:xampphtdocscakephpwebrootindex.php, line: 35 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Use CakeHttpResponse instead of CakeNetworkResponse. - E:xampphtdocscakephpvendorcomposerClassLoader.php, line: 444 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Dispatcher is deprecated. You should update your application to use the HttpServer implementation instead. - E:xampphtdocscakephpwebrootindex.php, line: 37 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ActionDispatcher::addFilter() is deprecated. This is only available for backwards compatibility with DispatchFilters - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpActionDispatcher.php, line: 61 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ActionDispatcher::addFilter() is deprecated. This is only available for backwards compatibility with DispatchFilters - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpActionDispatcher.php, line: 61 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ActionDispatcher::addFilter() is deprecated. This is only available for backwards compatibility with DispatchFilters - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpActionDispatcher.php, line: 61 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ActionDispatcher::addFilter() is deprecated. This is only available for backwards compatibility with DispatchFilters - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpActionDispatcher.php, line: 61 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ServerRequest::addParams() is deprecated. Use withParam() or withAttribute("params", $params) instead. - E:xampphtdocscakephpvendorcakephpcakephpsrcRoutingFilterRoutingFilter.php, line: 59 [COREsrcCorefunctions.php, line 305] Deprecated (16384): ServerRequest::session() is deprecated. Use getSession() instead. The setter part will be removed. - E:xampphtdocscakephpsrcControllerAppController.php, line: 120 [COREsrcCorefunctions.php, line 305] Deprecated (16384): AppModelTableUsersTable::table() is deprecated. Use setTable()/getTable() instead. - E:xampphtdocscakephpsrcModelTableUsersTable.php, line: 27 [COREsrcCorefunctions.php, line 305] Deprecated (16384): AppModelTableUsersTable::displayField() is deprecated. Use setDisplayField()/getDisplayField() instead. - E:xampphtdocscakephpsrcModelTableUsersTable.php, line: 37 [COREsrcCorefunctions.php, line 305] Deprecated (16384): AppModelTableUsersTable::primaryKey() is deprecated. Use setPrimaryKey()/getPrimaryKey() instead. - E:xampphtdocscakephpsrcModelTableUsersTable.php, line: 38 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Response::send() will be removed in 4.0.0 - E:xampphtdocscakephpvendorcakephpcakephpsrcRoutingDispatcher.php, line: 72 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Will be removed in 4.0.0 - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpResponse.php, line: 494 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Will be removed in 4.0.0 - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpResponse.php, line: 495 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Response::body() is deprecated. Mutable response methods are deprecated. Use withBody() and getBody() instead. - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpResponse.php, line: 502 [COREsrcCorefunctions.php, line 305] Deprecated (16384): Will be removed in 4.0.0 - E:xampphtdocscakephpvendorcakephpcakephpsrcHttpResponse.php, line: 502 [COREsrcCorefunctions.php, line 305] Home About Services Contact Us . Notice (8): Undefined variable: flasharea [APP/TemplateLayoutdefault.ctp, line 325]

Deprecated (16384): AppModelTableWebsitesTable::table() is deprecated. Use setTable()/getTable() instead. - E:xampphtdocscakephpsrcModelTableWebsitesTable.php, line: 33 [COREsrcCorefunctions.php, line 305] Deprecated (16384): AppModelTableWebsitesTable::displayField() is deprecated. Use setDisplayField()/getDisplayField() instead. - E:xampphtdocscakephpsrcModelTableWebsitesTable.php, line: 34 [COREsrcCorefunctions.php, line 305] Deprecated (16384): AppModelTableWebsitesTable::primaryKey() is deprecated. Use setPrimaryKey()/getPrimaryKey() instead. - E:xampphtdocscakephpsrcModelTableWebsitesTable.php, line: 35 [COREsrcCorefunctions.php, line 305]

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  • You didn't read the error message. It already tells you how to fix it.
  • You didn't check the change log nor the migration guide and making an update over two version, jumping from 3.4 over to 3.6. This is pretty careless.
  • You didn't bother to check the php manual for the deprecation warning. A simple Google search for "php 16384" would have brought you to this page.
  • You didn't do a search here on SO about deprecation warnings

The php manual explains it:

User-generated warning message. This is like an E_DEPRECATED, except it is generated in PHP code by using the PHP function

E_DEPRECATED:

Run-time notices. Enable this to receive warnings about code that will not work in future versions.

Your conclusion should be that you should update your code to the new method calls that the warnings already suggest you to use. You should also consider that there might be code you don't have direct control over, like plugins, that might require the new version at some point. So make sure your dependency versions are setup in a way you won't get in trouble with.

For the future fix your personal workflow:

  • Check google for error code / message if you don't understand it
  • When doing updates that aren't minors check the change log and migration guide before even considering an update. Worst case is that an update will take you more time than you have, especially if you didn't bother to check what actually could or clearly will blow up because of changes
  • Make sure dependencies will work with the new version as well

You can still disable the notices just for the framework via config:

// in config/app.php
'Error' => [
    'errorLevel' => E_ALL ^ E_USER_DEPRECATED
]

Be aware, this won't make it work, it just hides the warnings!

When the deprecated methods get removed you're screwed. So plan ahead, allocate the time needed to update the code in your roadmap and do it when you have time before you don't have it and are forced to update for some reason.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...