-
Support Thread: Report All Errors (Even Warnings)
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!
-
Re: Support Thread: Report All Errors (Even Warnings)
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!
-
Re: Support Thread: Report All Errors (Even Warnings)
v1.1.0 is now available for download ...
-
Re: Support Thread: Report All Errors (Even Warnings)
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
lat9
v1.1.0 is now available for download ...
Absolute cracker - well done!! Should be part of the standard file system :yes:
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted 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.
Good point, I'll put together a proposal and post here before including it in the updated readme.html file.
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
frank18
Absolute cracker - well done!! Should be part of the standard file system :yes:
Thanks, Frank.:blush:
-
Re: Support Thread: Report All Errors (Even Warnings)
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
Code:
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
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? . . .
-
Re: Support Thread: Report All Errors (Even Warnings)
: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:
Code:
$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\'),')");
-
Re: Support Thread: Report All Errors (Even Warnings)
I just submitted v2.0.1 to the plugins, correcting the error reported by @AndyJordaan: https://www.zen-cart.com/downloads.php?do=file&id=1792
The update is available now on the plugin's GitHub repository.
-
Re: Support Thread: Report All Errors (Even Warnings)
v2.0.1 is now available for download from the Zen Cart plugins.
-
Re: Support Thread: Report All Errors (Even Warnings)
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.
-
Re: Support Thread: Report All Errors (Even Warnings)
v2.0.2 is now available for download from the Zen Cart Plugins.
-
Re: Support Thread: Report All Errors (Even Warnings)
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:
PHP Code:
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?
-
Re: Support Thread: Report All Errors (Even Warnings)
@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.
-
Re: Support Thread: Report All Errors (Even Warnings)
-
Re: Support Thread: Report All Errors (Even Warnings)
Thanks, DrByte! I've incorporated those changes and uploaded v2.0.3 of Report All Errors to the plugins.
-
Re: Support Thread: Report All Errors (Even Warnings)
With && fix applied, there are still PHP Notices being shown when using the module.
I guess I misunderstood about Notices being disabled as I can see in Configuration -> Logging it states:
Do you want create debug-log files for all PHP errors, even warnings,
Perhaps disabling Notices can be a feature in a future version? :smile:
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
Website Rob
With && fix applied, there are still PHP Notices being shown when using the module.
I guess I misunderstood about Notices being disabled as I can see in Configuration -> Logging it states:
Do you want create debug-log files for all PHP errors, even warnings,
Perhaps disabling Notices can be a feature in a future version? :smile:
With the change, notices should (by default) not be logged when Report All Errors is disabled, with only Error and Warning type issues being logged. The (even warnings) addition in the plugin's name should, thus, just be ignored.
-
Re: Support Thread: Report All Errors (Even Warnings)
I can confirm that when All Errors features are disabled, no PHP Notices are recorded / shown when the fix mentioned earlier by Dr. Byte has been applied.
If you want the module other features they need to be manually enabled.
Admin -> Configuration -> Logging
Report All Errors (Admin)?
Report All Errors (Store)?
Report All Errors: Backtrace on Notice Errors?
And that is when PHP Notices will also be recorded / shown.
In continued testing I noticed something not mentioned in the module documentation. In v2.0.2 (v2.0.3 is not available as of today's date) I did not read anywhere that the module is enabled by default and will record / display only error(s). That was a pleasant surprize and exactly what I was looking for.
Also, I know at one time it was possible for PHP to also state at what character in the line the error found. Not sure if that is possible anymore but be nice to have again.
-
Re: Support Thread: Report All Errors (Even Warnings)
v2.0.3 is now available for download from the Plugins area.
-
Re: Support Thread: Report All Errors (Even Warnings)
Not sure if I missed it in the thread or not, but when I installed it, both my admin and live site were replaced with a page listing all the errors. Decent little heart attack there, until I disabled the actual php files (just added ~ at the end of them all), but I did save the generated log. Came back with close to 1000 undefined and already defined index and constants, plus a smattering of others. I saw the notice about the already defined ones, but what about all the undefined? My site WORKS... but that's still a LOT of errors that came up...
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
Lordzoabar
Not sure if I missed it in the thread or not, but when I installed it, both my admin and live site were replaced with a page listing all the errors. Decent little heart attack there, until I disabled the actual php files (just added ~ at the end of them all), but I did save the generated log. Came back with close to 1000 undefined and already defined index and constants, plus a smattering of others. I saw the notice about the already defined ones, but what about all the undefined? My site WORKS... but that's still a LOT of errors that came up...
What version of Zen Cart and PHP are you using?
Report All Errors does, as you indicated, have a setting to "not report" those already-defined constants. Those issues are normally due to the way that Zen Cart handles cascading language files, e.g. the file /includes/languages/english.php gets loaded in addition to /includes/languages/YOUR_TEMPLATE/english.php. Those reports do not pose any current issue.
The reports of undefined constants are, however, of concern. PHP 7.2's release indicates that the use of undefined constants is deprecated, and will result in an error in a future PHP version. That said, I'd focus my inspection on those reports!
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
lat9
What version of Zen Cart and PHP are you using?
Zen Cart 1.5.5d, and PHP 5.4.45
I've broken down the main log file, into multiple, individual files based on which php file is in question, but the website has been around longer than I have been with the company, so there is a lot of stuff to shift through, and (unfortunately) there was never a "sandbox" version of the store set up to safely test any fixes in.
-
Re: Support Thread: Report All Errors (Even Warnings)
Any reason the store is still on that oldy-moldy version of PHP?
Creating a sandbox site is pretty easy; if you're interested, please start a new forum thread so we don't muddy-up this plugin's support thread.
-
Re: Support Thread: Report All Errors (Even Warnings)
I've just submitted v3.0.0 of Report All Errors to the Zen Cart plugins for review; once approved, it can be downloaded from this link (https://www.zen-cart.com/downloads.php?do=file&id=1792).
This version uses the common admin/storefront processing now provided by zc156 as its change-basis.
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
lat9
I've just submitted v3.0.0 of
Report All Errors to the Zen Cart plugins for review; once approved, it can be downloaded from this link (
https://www.zen-cart.com/downloads.php?do=file&id=1792).
This version uses the common admin/storefront processing now provided by zc156 as its change-basis.
v3.0.0 is now available for download!
-
Re: Support Thread: Report All Errors (Even Warnings)
A bit off-topic, but may be of interest....
I spent months of working locally (xampp, whatever the latest version is this week) diligently swatting the nit-picking debugs raised by this plugin, and even more diligently reporting them if not already fixed in ZC157, to ensure that all would be well when upgrading my site to ZC156 and php7.3.x. and I would not be swamped with a barrage of php errors.
I tested it on another domain from the same hosting service @php7.3, since I had to maintain the current site @php7.1, assuming that real hosting would show up more stuff, but all was clear there (I have an obsession with keeping all testing well away from the production site, not even on the same server).
Then, post upgrade on the real domain...rapidly a barrage of php notices appeared which I have just finished working through.
All were the usual undefined variables/offsets, some due to mangled urls being used by spiders so they could not be predicted, and some already fixed in ZC57.
But some were typical that should have showed up in local testing.
Comparing error_reporting values I see the production server is different, but for local, not master, which confuses me since as far as I know, that is determined in the fileset, which is identical across three servers.
Local / Master
xampp
32767 / 32767
hosting test
32767 / 32759
hosting production
22519 / 32759
So, not a question as such, but a reminder (to me mainly) that there is no substitute for final testing in parallel/on the same server, and to point out that you should upgrade early in the day, in a darkened room, ready for battle!!
And that having this plugin permanently enabled may still not catch everything!
-
Re: Support Thread: Report All Errors (Even Warnings)
I've just submitted v3.1.0 of Report All Errors to the Zen Cart moderators for review and will post back here when it's available for download.
This release contains the change associated with GitHub issue #9, now collecting reported errors into per-page-load files that identify the error(s)' severity.
-
Re: Support Thread: Report All Errors (Even Warnings)
Quote:
Originally Posted by
lat9
I've just submitted v3.1.0 of Report All Errors to the Zen Cart moderators for review and will post back here when it's available for download.
This release contains the change associated with GitHub issue
#9, now collecting reported errors into per-page-load files that identify the error(s)' severity.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=1792