Changeset 3639213
- Timestamp:
- 08/09/2026 09:45:25 AM (3 months ago)
- Location:
- fizteq-pulse
- Files:
-
- 1 added
- 4 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (modified) ( previous)
-
trunk/includes/monitors/class-monitor-errors.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wppulse.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fizteq-pulse/trunk/includes/monitors/class-monitor-errors.php
r3512777 r3639213 25 25 private $max_frames = 50; 26 26 27 /** 28 * Error levels we report, and the only ones handle_error() acts on. 29 * 30 * This is deliberately both the set_error_handler() mask and an explicit 31 * check inside the handler. The mask alone only governs what PHP itself 32 * dispatches: when another plugin or theme registers its own handler and 33 * chains to the previous one with call_user_func, our handler is invoked 34 * directly for every level and the mask is bypassed entirely. That is how 35 * deprecations reached the dashboard before this — arriving as E_UNKNOWN, 36 * from a site whose theme chains handlers, while the mask said E_USER_ERROR. 37 * 38 * We want them, but on purpose rather than by accident: a deprecation is how 39 * the site owner learns their theme breaks on the next PHP release. The 40 * dashboard classifies notices and deprecations as info, so they land in a 41 * daily summary rather than an immediate alert. 42 * 43 * E_STRICT is omitted: it has been deprecated as a constant since PHP 8.4 44 * and referencing it would have this plugin emit the very thing it reports. 45 * 46 * @return int 47 */ 48 private function reported_levels() 49 { 50 return E_ERROR | E_WARNING | E_PARSE | E_NOTICE 51 | E_CORE_ERROR | E_CORE_WARNING 52 | E_COMPILE_ERROR | E_COMPILE_WARNING 53 | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE 54 | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED; 55 } 56 27 57 public static function get_key() 28 58 { … … 38 68 $this->previous_exception_handler = set_exception_handler([$this, 'handle_exception']); 39 69 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler -- Error tracking is the plugin's core purpose. 40 $this->previous_error_handler = set_error_handler([$this, 'handle_error'], E_USER_ERROR);70 $this->previous_error_handler = set_error_handler([$this, 'handle_error'], $this->reported_levels()); 41 71 register_shutdown_function([$this, 'handle_shutdown']); 42 72 } … … 70 100 71 101 /** 72 * Handle PHP errors (E_USER_ERROR). 102 * Handle a PHP error. 103 * 104 * The errno check is not redundant with the set_error_handler() mask — see 105 * reported_levels(). A chained handler calling us directly bypasses the mask, 106 * so without this the plugin reports whatever that handler happened to 107 * receive, including levels it was never configured for. 108 * 109 * Also honours the site's own error_reporting() level, so a host that has 110 * switched deprecations off is not overridden by us. 73 111 * 74 112 * @param int $errno … … 80 118 public function handle_error($errno, $errstr, $errfile, $errline) 81 119 { 120 $reportable = ($errno & $this->reported_levels()) && (error_reporting() & $errno); 121 122 if (! $reportable) { 123 if ($this->previous_error_handler !== null) { 124 return call_user_func($this->previous_error_handler, $errno, $errstr, $errfile, $errline); 125 } 126 127 return false; 128 } 129 82 130 try { 83 131 if (! $this->is_handling && $this->errors_reported < $this->max_errors_per_request) { … … 234 282 private function error_type_string($type) 235 283 { 284 /** 285 * The dashboard maps these names to a severity, so an unmapped level 286 * costs more than a cosmetic label: everything used to collapse to 287 * E_UNKNOWN, which is classified critical, and a theme's deprecations 288 * therefore alerted like fatals. 289 */ 236 290 $map = [ 237 291 E_ERROR => 'E_ERROR', 292 E_WARNING => 'E_WARNING', 238 293 E_PARSE => 'E_PARSE', 294 E_NOTICE => 'E_NOTICE', 239 295 E_CORE_ERROR => 'E_CORE_ERROR', 296 E_CORE_WARNING => 'E_CORE_WARNING', 240 297 E_COMPILE_ERROR => 'E_COMPILE_ERROR', 298 E_COMPILE_WARNING => 'E_COMPILE_WARNING', 241 299 E_USER_ERROR => 'E_USER_ERROR', 300 E_USER_WARNING => 'E_USER_WARNING', 301 E_USER_NOTICE => 'E_USER_NOTICE', 302 E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', 303 E_DEPRECATED => 'E_DEPRECATED', 304 E_USER_DEPRECATED => 'E_USER_DEPRECATED', 242 305 ]; 243 306 -
fizteq-pulse/trunk/readme.txt
r3636815 r3639213 4 4 Requires at least: 5.9 5 5 Tested up to: 7.0 6 Stable tag: 1.0.1 36 Stable tag: 1.0.14 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 157 157 == Changelog == 158 158 159 = 1.0.14 = 160 * New: PHP warnings, notices and deprecations are now reported with their actual error level, so the dashboard can rank them properly — deprecations and notices appear in your daily summary instead of alerting like a fatal error 161 * Fix: the error levels the plugin reports are now enforced inside the handler as well as declared. A theme or plugin that installs its own error handler and chains to ours could previously feed us levels we were never configured to collect 162 * The site's own error_reporting() level is now respected, so a host that has switched deprecation notices off is no longer overridden 163 159 164 = 1.0.13 = 160 165 * Fix: sites updating from an earlier version now report their plugin and theme inventory straight away, instead of waiting for the next daily check -
fizteq-pulse/trunk/wppulse.php
r3636815 r3639213 4 4 * Plugin URI: https://wp-pulse.app 5 5 * Description: Error tracking and site health monitoring for WordPress agencies. Reports errors, plugin changes, and health data to your WPPulse dashboard. 6 * Version: 1.0.1 36 * Version: 1.0.14 7 7 * Author: FizteQ 8 8 * Author URI: https://fizteq.com … … 25 25 } 26 26 27 define('WPPULSE_VERSION', '1.0.1 3');27 define('WPPULSE_VERSION', '1.0.14'); 28 28 define('WPPULSE_PLUGIN_FILE', __FILE__); 29 29 define('WPPULSE_PLUGIN_DIR', plugin_dir_path(__FILE__));
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)