Report All Errors for Zen Cart v1.5.1 through v1.5.6

Version 3.1.0 by lat9

Copyright © 2013-2020 Vinos de Frutas Tropicales. All rights reserved.


Current Support Thread at Zen Cart Forums: https://www.zen-cart.com/showthread.php?211217-Support-Thread-Report-All-Errors-%28Even-Warnings%29

This plugin provides an easy way for developers to control the logging of all PHP-related errors to a myDEBUG*.log file. After you've installed the plugin, there are three new values in your admin's Configuration->Logging:

  1. Report All Errors (Admin)?. Set this value to Yes to enable all PHP errors to be reported for admin-related pages. Use the IgnoreDups setting to cause the processing to not log the duplicate-constant messages described below.
  2. Report All Errors (Store)?. Set this value to Yes to enable all PHP errors to be reported for store-related pages. Use the IgnoreDups setting to cause the processing to not log the duplicate-constant messages described below.
  3. Report All Errors: Backtrace on Notice Errors?. Set this value to Yes to include the "backtrace" information with each PHP Notice report, increasing the size of the generated .log file. The default value of No should be used in most circumstances, since those "Notice" errors are normally due to a coding construct present in the file named in the report. (Added in v2.0.2)

Notes:

  1. Use caution when enabling this plugin on a live store as your store's performance will most likely be significantly reduced!
  2. The store-side debug-log files can be very large, so make sure that you clean them out periodically.

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-override 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. These notices can be safely ignored; you can use the plugin's IgnoreDups setting to cause these notifications to not be logged.

Starting with v3.1.0, the plugin now collects, for each "page-load", the reported errors into one or more log files based on an error's severity:

  1. If a logfile ends in -deprecated.log, that file contains PHP Deprecation messages.
  2. If a logfile ends in -warning.log, that file contains PHP Warning messages.
  3. If a logfile ends in -error.log, that file contains PHP Error messages.
  4. Otherwise, a file contains PHP Notice messages.

Refer to the comments present in /includes/extra_configures/enable_error_logging.php for additional information.

This section identifies the procedure you'll use to install/update or remove the plugin for your Zen Cart.

There are two core-file overwrites in this plugin; you should always backup your cart's database and files prior to making any changes.

  1. Rename the YOUR_ADMIN folder to match your store's "secret" admin-folder name.
  2. Copy the plugin's files to your store's file-system:
    1. /includes/auto_loaders/config.report_all_errors.php
    2. /includes/auto_loaders/paypal_ipn.report_all_errors.php
    3. /includes/extra_configures/enable_error_logging.php
    4. /includes/init_includes/init_report_all_errors.php
    5. /YOUR_ADMIN/includes/auto_loaders/config.report_all_errors_admin.php
    6. /YOUR_ADMIN/includes/extra_configures/enable_error_logging.php
    7. /YOUR_ADMIN/includes/init_includes/init_report_all_errors_admin.php
  3. Log into your Zen Cart admin. The plugin's auto-installer will run, creating new settings in Configuration->Logging.

The plugin's undergone some re-construction starting in v2.0.0, adding an additional configuration setting. The easiest way to upgrade to v2.x.x from 1.x.x is to run the plugin's SQL uninstall script and then follow the installation instructions.

First, delete the files that were copied to your Zen Cart installation's file-system, restoring any core-file overrides that might have been necessary. Then use your admin's Tools->Run SQL Patches to run the file /docs/report_all_errors/uninstall/report_all_errors_uninstall.sql.

  • v3.1.0, 2020-01-23
    • CHANGE: Updated to 'group' logs of the same severity (notice, deprecated, warning, error) into separate per-page-load files.
      1. /includes/extra_configures/enable_error_logging.php
  • v3.0.0, 2019-03-17
    • CHANGE: Use the zc156 version of the "enable_error_logging.php" processing as the change-basis.
    • The following files were changed:
      1. /includes/extra_configures/enable_error_logging.php
      2. /includes/init_includes/init_report_all_errors.php
      3. /YOUR_ADMIN/includes/extra_configures/enable_error_logging.php (This is the zc156 version of the file)
      4. /YOUR_ADMIN/includes/init_includes/init_report_all_errors_admin.php
  • v2.0.3, 2016-11-15
    • BUGFIX: PHP "Notice" issues are getting logged, even when the plugin is disabled and the PHP version is >= 5.4.
  • v2.0.2, 2016-09-15
    • BUGFIX: IgnoreDups handling was incorrect, so the setting was never applied.
    • CHANGE: Add configuration setting to conditionally remove the backtrace information from "PHP Notice" issues. Those tend to be specific to the reported filename and having the backtrace information simply serves to increase the size of the generated .log file.
    • CHANGE: Remove extra whitespace (and CRLF characters) from the end of the generated backtrace; an additional new-line was being added, also increasing the size/viewability of the generated log file.
    • CHANGE: Properly comment the changes to the Zen Cart core-files, using Zen Cart 1.5.5a as the basis.
  • v2.0.1, 2016-08-29
    • BUGFIX: Correct auto-installer SQL error.
  • v2.0.0, 2016-08-28
    • CHANGE: Move stand-alone SQL install script into an admin-level auto-installer.
    • CHANGE: Add configuration settings to allow the duplicate-constants PHP notifications to be ignored.
  • v1.1.2, 2015-12-30
    • Updated the two core-files modified by this plugin to use the downward-compatible versions provided by Zen Cart v1.5.5.
  • v1.1.1, 2014-05-17
    • Added notes to this readme file, indicating that some of the PHP notifications/warnings are to be expected (based on the Zen Cart architecture)!
    • Updated the readme to identify that the plugin is compatible with Zen Cart v1.5.3.
  • v1.1.0, 2013-12-06
    • Modified method used to enable — was via $_GET variable, now via admin-configurable switches.
    • v1.0.0, 2013-12-03, Initial release.