PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 13, 2022

[FIXED] How do I force CakePHP 3 and CakePHP 4 to show the deprecation warnings / notices?

 March 13, 2022     cakephp, cakephp-3.0, cakephp-4.x, deprecated, deprecation-warning     No comments   

Issue

What I did

  • Purposefully put $this->primaryKey('id') in my Table class
  • Call ->find('all')->all() on that Table inside Controller

What I expected

A deprecation notice at the top of my screen since primaryKey() is deprecated.

What actually happened

Everything worked with no errors shown

What have I checked

  • display_errors is On in phpinfo()
  • error_reporting is 32767 a.k.a. E_ALL in phpinfo()
  • $this->TESTprimaryKey('id') raises BadMethodCallException Unknown method "TESTprimaryKey", meaning it's the right Table
  • Error.errorLevel set to E_ALL in my app.php
  • php composer.phar upgrade and php composer.phar update just in case
  • VERSION.txt shows 3.6.10. All of this is also true for 4.2.4.

Solution

This looks all good, E_ALL includes deprecations, and as long as debug is enabled in your app configuration, deprecation warnings will be shown (irrespectively of PHPs display_errors setting).

If you are using Debug Kit, deprecation warnings will be intercepted by it, and they can be found in the Deprecations panel.



Answered By - ndm
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing