[wp-hackers] Re: [wp-svn] [5087] trunk: (int)er the dragon.
Ryan Boren
ryan at boren.nu
Fri Mar 23 01:31:23 GMT 2007
On 3/22/07, m at wordpress.org <m at wordpress.org> wrote:
>
>
> Revision 5087 Author matt Date 2007-03-23 00:59:21 +0000 (Fri, 23 Mar 2007)
> Log Message (int)er the dragon.
> + if ( !$user_id = (int) add_user() )
> + $id = (int) wp_write_post();
These can return WP_Error objects. Casting to int breaks them. I
don't think we should cast to int return values from our own
functions. They should return an int or WP_Error as appropriate.
> + $postID = (int) wp_insert_post($post_data);
> + $postID = (int) wp_insert_attachment($attachment, $file,
> + $cat_id = (int) wp_create_category( $cat_name );
> + if ( $pid = (int) wp_insert_post( array(
> + $mid = (int) add_meta( $pid );
> + } else if ( !$mid = (int) add_meta( $id ) ) {
More information about the wp-hackers
mailing list