From 247cdad571f5aea329aefbd49ef7c2180bf5d186 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 18 Jan 2015 20:33:23 +0000 Subject: [PATCH] attachment_url_to_postid() should always return an integer. props nathan_dawson, ashfame. fixes #31044. Built from https://develop.svn.wordpress.org/trunk@31239 git-svn-id: http://core.svn.wordpress.org/trunk@31220 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 7 +++---- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 6a1bddbefc..506c86c5ee 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -3295,7 +3295,7 @@ function wp_maybe_generate_attachment_metadata( $attachment ) { * @global wpdb $wpdb WordPress database abstraction object. * * @param string $url The URL to resolve. - * @return int The found post ID. + * @return int The found post ID, or 0 on failure. */ function attachment_url_to_postid( $url ) { global $wpdb; @@ -3312,9 +3312,8 @@ function attachment_url_to_postid( $url ) { $path ); $post_id = $wpdb->get_var( $sql ); - if ( ! empty( $post_id ) ) { - return (int) $post_id; - } + + return (int) $post_id; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index bad6db3b47..150d779507 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31238'; +$wp_version = '4.2-alpha-31239'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.