Skip to content

Commit 776bb36

Browse files
authored
Merge pull request #62 from awesomemotive/issue/59
Admin: prevent PHP fatal error inside of get_transient_value_type()
2 parents 69dd863 + 0148161 commit 776bb36

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

transients-manager.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,6 @@ private function get_transient_value_type( $transient ) {
825825
if ( is_array( $value ) ) {
826826
$type = esc_html__( 'array', 'transients-manager' );
827827

828-
// JSON
829-
} elseif ( is_object( json_decode( $value ) ) ) {
830-
$type = esc_html__( 'json', 'transients-manager' );
831-
832828
// Object
833829
} elseif ( is_object( $value ) ) {
834830
$type = esc_html__( 'object', 'transients-manager' );
@@ -859,6 +855,11 @@ private function get_transient_value_type( $transient ) {
859855
$type = esc_html__( 'numeric', 'transients-manager' );
860856
}
861857

858+
// JSON
859+
} elseif ( is_string( $value ) && is_object( json_decode( $value ) ) ) {
860+
$type = esc_html__( 'json', 'transients-manager' );
861+
862+
// Scalar
862863
} else {
863864
$type = esc_html__( 'scalar', 'transients-manager' );
864865
}

0 commit comments

Comments
 (0)