Hah, I submitted that inside another patch a few days ago! :)

http://trac.wordpress.org/attachment/ticket/8705/8705.diff

2008/12/24 Krusty Ruffle <[email protected]>

> Using WP 2.7, if you test for a custom value that is not there you will get
> an Undefined Index Notice, (only when define('WP_DEBUG',true); of course.)
>
> So, the Sandbox uses:
>
> <?php if ( get_post_custom_values('comments') ) comments_template() // Add
> a
> key+value of "comments" to enable comments on this page ?>
>
> to test if the user wants comments on a page, if the 'comments' value it
> not
> set then you get a notice.
>
> If you go to wp-includes/post.php line #739 you see:
>
> function get_post_custom_values( $key = '', $post_id = 0 ) {
>    $custom = get_post_custom($post_id);
>
>    return $custom[$key];
> }
>
> If you add one line like below, the notice goes away:
>
> function get_post_custom_values( $key = '', $post_id = 0 ) {
>    $custom = get_post_custom($post_id);
>
>    if ( isset($custom[$key]) )
>        return $custom[$key];
> }
>
> I'm sorry that I have no idea how to make and submit a patch, or if this is
> the best solution, and I know this is a minor thing, I just thought someone
> may be interested in knowing about it...
>
> Thanks for reading :)
> _______________________________________________
> wp-testers mailing list
> [email protected]
> http://lists.automattic.com/mailman/listinfo/wp-testers
>
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to