From 2be32d5d193812c2c5c4b79e5b82429ab65a674d Mon Sep 17 00:00:00 2001 From: r-a-y Date: Thu, 8 Oct 2020 18:22:53 -0700 Subject: [PATCH 1/2] Fix fatal error for Post_Meta\remove_schedule() return type. This commit switches the return type from bool to void, since remove_schedule() is hooked to an action, not a filter. Also, Unpublish\unschedule_unpublish() can return an integer and not a bool, which can throw a fatal error. --- inc/post-meta.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/inc/post-meta.php b/inc/post-meta.php index 1e7cfbb..33a3513 100644 --- a/inc/post-meta.php +++ b/inc/post-meta.php @@ -63,15 +63,11 @@ function update_schedule( int $meta_id, int $object_id, string $meta_key, $meta_ * @param int[] $meta_ids An array of deleted metadata entry IDs. * @param int $object_id Object ID. * @param string $meta_key Meta key. - * - * @return bool */ -function remove_schedule( array $meta_ids, int $object_id, string $meta_key ) : bool { +function remove_schedule( array $meta_ids, int $object_id, string $meta_key ) : void { if ( $meta_key === Unpublish\POST_META_KEY ) { - return Unpublish\unschedule_unpublish( $object_id ); + Unpublish\unschedule_unpublish( $object_id ); } - - return false; } /** From 4e27253d5c7ad3c681d855b62639a99d8e930c88 Mon Sep 17 00:00:00 2001 From: r-a-y Date: Tue, 9 Mar 2021 00:01:22 -0800 Subject: [PATCH 2/2] Fix fatal error for Post_Meta\update_schedule() return type. Same as remove_schedule() fix, but for update_schedule(). --- inc/post-meta.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/post-meta.php b/inc/post-meta.php index 33a3513..9d825a2 100644 --- a/inc/post-meta.php +++ b/inc/post-meta.php @@ -43,17 +43,17 @@ function register_meta( string $post_type ) : void { * @param string $meta_key Meta key. * @param mixed $meta_value Meta value. * - * @return bool + * @return void */ -function update_schedule( int $meta_id, int $object_id, string $meta_key, $meta_value ) : bool { +function update_schedule( int $meta_id, int $object_id, string $meta_key, $meta_value ) : void { if ( $meta_key !== Unpublish\POST_META_KEY ) { - return false; + return; } if ( $meta_value ) { - return Unpublish\schedule_unpublish( $object_id, absint( $meta_value ) ); + Unpublish\schedule_unpublish( $object_id, absint( $meta_value ) ); } else { - return Unpublish\unschedule_unpublish( $object_id ); + Unpublish\unschedule_unpublish( $object_id ); } }