From cf4380638a0a85be62d3821cd0b422ae103fb58e Mon Sep 17 00:00:00 2001 From: Archetyped Date: Tue, 6 Sep 2022 18:33:18 -1000 Subject: [PATCH] fix(activation/hooks): ensure priority value is valid * closes #964 * related: `activate/hook_priority` (08f0a07) --- controller.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller.php b/controller.php index f11adb6..fceeac9 100644 --- a/controller.php +++ b/controller.php @@ -285,7 +285,11 @@ public function hooks_add_last( $data = null ) { } // Get lowest priority for filter. - $max_priority = max( array_keys( $wp_filter[ $tag ]->callbacks ) ) + 123; + $max_priority = max( array_keys( $wp_filter[ $tag ]->callbacks ) ); + // Add priority offset + if ( $max_priority < PHP_INT_MAX ) { + $max_priority += min( 123, PHP_INT_MAX - $max_priority ); + } switch ( $tag ) { case 'the_content':