From 09bddcfd42fce196773a933c512f30d24952d537 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Sun, 12 Mar 2023 15:26:50 -0500 Subject: [PATCH] Fix potential PHP fatal with array check in PHP 8+ --- classes/PodsInit.php | 14 ++++++++++---- package.json | 2 +- readme.txt | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/classes/PodsInit.php b/classes/PodsInit.php index 7a67b4eee2..dfb230d995 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -1367,11 +1367,17 @@ public function setup_content_types( $force = false ) { $cpt_positions = array(); - if ( empty( $pods_cpt_ct ) && ( ! empty( $post_types ) || ! empty( $taxonomies ) ) ) { - $force = true; - } elseif ( ! empty( $pods_cpt_ct ) && count( $pods_cpt_ct['post_types'] ) !== count( $post_types ) ) { + if ( ! is_array( $pods_cpt_ct ) ) { + $pods_cpt_ct = false; + } + + if ( empty( $pods_cpt_ct ) ) { + if ( ! empty( $post_types ) || ! empty( $taxonomies ) ) { + $force = true; + } + } elseif ( isset( $pods_cpt_ct['post_types'] ) && count( $pods_cpt_ct['post_types'] ) !== count( $post_types ) ) { $force = true; - } elseif ( ! empty( $pods_cpt_ct ) && count( $pods_cpt_ct['taxonomies'] ) !== count( $taxonomies ) ) { + } elseif ( isset( $pods_cpt_ct['taxonomies'] ) && count( $pods_cpt_ct['taxonomies'] ) !== count( $taxonomies ) ) { $force = true; } diff --git a/package.json b/package.json index 0a6b86df21..b13284aa49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pods", - "version": "2.9.12.1", + "version": "2.9.12.2", "description": "Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.", "author": "Pods Foundation, Inc", "homepage": "https://pods.io/", diff --git a/readme.txt b/readme.txt index 49d639869d..8f0a836034 100644 --- a/readme.txt +++ b/readme.txt @@ -175,6 +175,10 @@ Pods really wouldn't be where it is without all the contributions from our [dono == Changelog == += 2.9.12.2 - March 12th, 2023 = + +* Fixed: PHP > Fix potential PHP fatal in PHP 8+ with certain cached data when cache returns string instead of an expected array. (@sc0ttkclark) + = 2.9.12.1 - March 10th, 2023 = * Fixed: Components > Fix potential PHP fatal in PHP 8+ with the Translate Pods component. #7023 (@sc0ttkclark)