﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
20870,error notice when $post = NULL with gallery_shortcode,thomask,,"i have noticed with many relevant plugins and functions it may happen, that gallery_shortcode is called when global $post returns NULL. problem is, that gallery_shortcode function media.php containts 

{{{
		'id'         => $post->ID,
}}}

(row 798 on 3.4 or 783 on 3.3.2) so when $post is NULL it returns error notice

there is trivial solution - adding (!$post) check just after the $output filter (so it could be rewriten by plugin authors) - see last line:


{{{
function gallery_shortcode($attr) {
	global $post;

	static $instance = 0;
	$instance++;

	// Allow plugins/themes to override the default gallery template.
	$output = apply_filters('post_gallery', '', $attr);
	if ( $output != '' )
		return $output;

        if (!$post) return;
}}}


(sorry, i do not know how to change it on svn). This bug is even on 3.3.2 even on latest 3.4",defect (bug),new,normal,Awaiting Review,Media,3.3,trivial,,,
