Check if the `$post_type` passed to `get_post_type_object()` is a `scalar` value. Non-scalars were producing PHP warnings.
Adds unit tests. Props Kloon. Fixes #30013. Built from https://develop.svn.wordpress.org/trunk@34100 git-svn-id: http://core.svn.wordpress.org/trunk@34068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fa1e1a8850
commit
5077d917a3
|
@ -835,10 +835,11 @@ function get_post_type( $post = null ) {
|
|||
function get_post_type_object( $post_type ) {
|
||||
global $wp_post_types;
|
||||
|
||||
if ( empty($wp_post_types[$post_type]) )
|
||||
if ( ! is_scalar( $post_type ) || empty( $wp_post_types[ $post_type ] ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $wp_post_types[$post_type];
|
||||
return $wp_post_types[ $post_type ];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34099';
|
||||
$wp_version = '4.4-alpha-34100';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue