If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Admin Tools / Support Thread: Report All Errors (Even Warnings)

Support Thread: Report All Errors (Even Warnings)

Started by lat9 on 3 Dec 2013, 6:07 PM · Views: 14,888

Results 1 to 20 of 35
3 Dec 2013, 6:07 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #1 by lat9

I was looking for an easy way to enable **all **error-reporting during my debugging ... and came up with this plugin. The plugin overwrites two core files to enable you to use a simple $_GET variable (report_all) to enable all error reporting for the selected page.

I'll be submitting this to the Plugins area shortly -- now that I've got a support thread!

28 Dec 2013, 1:20 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #2 by lat9

The plugin is available for download here: http://www.zen-cart.com/downloads.php?do=file&id=1792

I've just submitted v1.1.0 to the Plugins, which uses admin-configurable settings to enable/disable the feature instead of the $_GET variable approach used in v1.0.0.

P.S. No longer any core-file overwrites!

2 Jan 2014, 7:57 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #3 by lat9

v1.1.0 is now available for download ...

3 Jan 2014, 8:49 AM
#4
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #4 by torvista

Another excellent stick to beat myself over the head with! Well done, I hope the devs use this...

Maybe some user notes here would beneficial for the unwary.
i.e.
Notices about undefined or already defined constants in core code should be ignored unless no substitution has been assumed.
Warnings associated with core code are unlikely to be fixed at this point.
Just concentrate on warnings associated with your mods.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

3 Jan 2014, 10:45 AM
#5
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Post #5 by frank18

lat9:

v1.1.0 is now available for download ...

Absolute cracker - well done!! Should be part of the standard file system :yes:

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

3 Jan 2014, 5:20 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #6 by lat9

torvista:

Another excellent stick to beat myself over the head with! Well done, I hope the devs use this...

Maybe some user notes here would beneficial for the unwary.
i.e.
Notices about undefined or already defined constants in core code should be ignored unless no substitution has been assumed.
Warnings associated with core code are unlikely to be fixed at this point.
Just concentrate on warnings associated with your mods.
Good point, I'll put together a proposal and post here before including it in the updated readme.html file.

3 Jan 2014, 5:21 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #7 by lat9

frank18:

Absolute cracker - well done!! Should be part of the standard file system :yes:
Thanks, Frank.:blush:

3 Jan 2014, 7:05 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #8 by lat9

Here's the first of the list of PHP warnings that can be safely ignored:

The first time you enable the reporting of all errors on your store, you might see a number of items similar to

PHP Notice:  Constant SOME_LANGUAGE_CONSTANT_NAME already defined in {DIR_FS_CATALOG}\includes\languages\english.php on line xxx

These "notice" messages are issued if your store has made a template-based change to the default language file (for this example, english.php). That's because Zen Cart first loads your template-override language file and then — because sometimes new messages are introduced with a new Zen Cart version — loads the default language file.

23 May 2014, 6:30 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #9 by lat9

v1.1.1 is now available for download from the Plugins area, containing readme-only updates to (a) identify support for ZC 1.5.3 and (b) adding some "safe to ignore" notes per torvista's post #4 in this thread.

30 Dec 2015, 3:21 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #10 by lat9

I've just submitted v1.1.2 to the plugins for review, to update the core files distributed by the plugin to use the Zen Cart v1.5.5 version as the base.

Note: For stores running a Zen Cart version less than v1.5.5, this update will also pull in the changes provided by myDEBUG Backtrace, since that plugin is part of the core starting with ZC1.5.5.

28 Aug 2016, 3:52 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #12 by lat9

torvista:

... Notices about undefined or already defined constants in core code should be ignored unless no substitution has been assumed. ...
I just submitted v2.0.0 to the Plugins for review. That version adds another configuration setting (IgnoreDups) that causes those "already defined constant" notifications to not be logged.

29 Aug 2016, 7:51 AM
#13
andyjordaan avatar

andyjordaan

New Zenner

Join Date:
Mar 2012
Location:
South Africa- Krugersdorp
Posts:
29
Plugin Contributions:
0

Post #13 by andyjordaan

Hi Lat9
Just a heads up, I installed this mod on 1.5.5a --it killed my admin

sorry I will give more info when I have time , but I have bit to a problem to fix first
debug log snipet
"1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's processing? . . .

29 Aug 2016, 1:14 PM
#14
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #14 by lat9

:censored: Thanks, @AndyJordann, I'll get that corrected on GitHub and resubmit as v2.0.1. I failed to re-merge my development changes into the repository:

Edit to /YOUR_ADMIN/includes/init_includes/init_report_all_errors.php, replacing the two SQL inserts:

    $db->Execute ("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES ( 'Report All Errors (Admin)?', 'REPORT_ALL_ERRORS_ADMIN', 'No', 'Do you want create debug-log files for <b>all</b> PHP errors, even warnings, that occur during your Zen Cart admin\'s processing?  If you want to log all PHP errors <b>except</b> duplicate-language definitions, choose <em>IgnoreDups</em>.', 10, 40, now(), NULL, 'zen_cfg_select_option(array(\'Yes\', \'No\', \'IgnoreDups\'),')");
    
    $db->Execute ("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES ( 'Report All Errors (Store)?', 'REPORT_ALL_ERRORS_STORE', 'No', 'Do you want create debug-log files for <b>all</b> PHP errors, even warnings, that occur during your Zen Cart store\'s processing?  If you want to log all PHP errors <b>except</b> duplicate-language definitions, choose <em>IgnoreDups</em>.<br /><br /><strong>Note:</strong> Choosing \'Yes\' is not suggested for a <em>live</em> store, since it will reduce performance significantly!', 10, 41, now(), NULL, 'zen_cfg_select_option(array(\'Yes\', \'No\', \'IgnoreDups\'),')");
5 Sep 2016, 6:34 PM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #16 by lat9

v2.0.1 is now available for download from the Zen Cart plugins.

15 Sep 2016, 6:53 PM
#17
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #17 by lat9

Cripes, I was having a "bad hair day" when I released v2.0.0! I've submitted v2.0.2 to the plugins' area for review, correcting the handling for that IgnoreDups processing (i.e. making it actually work!).

Along the way, I've added another configuration setting since those "PHP Notice" issues are normally isolated to the file identified by the log and there's no need to add all that backtrace information that only serves to quadruple the size of the generated log.

19 Sep 2016, 11:35 AM
#18
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #18 by lat9

v2.0.2 is now available for download from the Zen Cart Plugins.

15 Nov 2016, 4:44 PM
#19
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Post #19 by website_rob

Looks like a very handy module and can see where I could use it except for one thing. Your coding appears to suppress Notices for PHP >=5.4 but it does not. Although I agree that Notices should be corrected at some point, in the name of correct and elegant coding, they only need to be shown at certain times.

I compared your code to my quicky:

if ($_SERVER['REMOTE_ADDR'] == "xxx") {
  ini_set('display_errors', 1);
  ini_set('error_reporting', E_ALL & ~E_NOTICE);
  } else {
  ini_set('display_errors', 0);
}

and Notices are suppressed. Not familiar enough with PHP to suggest a reason why your module is not suppressing Notices in my testing.

I'm testing with ZC v1.5.5 and your module version 2.0.2.

Also, perhaps I can request in an upcoming version that enabling for showing in Browser, depending on IP address as used in my quicky code, be a new feature?

The learning is in the doing.

Potent Products

15 Nov 2016, 6:28 PM
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #20 by lat9

@Website Rob, the code that is determining whether to suppress notices based on PHP versions is from the base Zen Cart module; if those notices aren't being suppressed, you should note that in a Zen Cart bug-report.

The "only" thing that report-all-errors adds to the mix is the enabling of the report of ***all ***errors, if configured.