From d2bece68e5c0035f06ecf42d97001f6e1a9689dc Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Wed, 28 Jun 2017 14:25:45 +0300 Subject: [PATCH] Added sanity check for invalid priority returned by core Fixes #9 --- CHANGELOG.md | 5 +++++ src/class-laps.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 908e58a..02eeef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +## 1.4.3 - 2017-06-28 + +### Fixed +- sanity check for invalid priority returned by core + ## 1.4.2 - 2016-12-02 ### Fixed diff --git a/src/class-laps.php b/src/class-laps.php index 0ba582c..6d38caf 100644 --- a/src/class-laps.php +++ b/src/class-laps.php @@ -95,6 +95,11 @@ class Laps { $filter_instance = $wp_filter[ $filter_name ]; $priority = $filter_instance instanceof \WP_Hook ? $filter_instance->current_priority() : key( $filter_instance ); + // See https://core.trac.wordpress.org/ticket/41185 on broken priority, but more general sanity check. + if ( empty( self::$events[ $filter_name ][ $priority ] ) ) { + return $input; + } + $event = wp_parse_args( self::$events[ $filter_name ][ $priority ], array(