Skip to content

Commit

Permalink
Fix potential PHP fatal with array check in PHP 8+
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Mar 12, 2023
1 parent 47a538c commit 09bddcf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 10 additions & 4 deletions classes/PodsInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 09bddcf

Please sign in to comment.