Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21797 closed defect (bug) (fixed)

get_the_excerpt() causing PHP notices. Undefined variable $post and Trying to get property of non object

Reported by: c3mdigital's profile c3mdigital Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: major Version: 3.5
Component: Warnings/Notices Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

In r21759 calling the_excerpt() generates 2 PHP Notices. See call stacks below.

Patch adds $post = get_post(); to get_the_excerpt();

 Notice: Undefined variable: post in /Users/chris/Sites/wp-trunk/wp-includes/post-template.php on line 268
Call Stack
#	Time	Memory	Function	Location
1	0.0002	231808	{main}( )	../index.php:0
2	0.0003	235024	require( '/Users/chris/Sites/wp-trunk/wp-blog-header.php' )	../index.php:17
3	0.2340	13729696	require_once( '/Users/chris/Sites/wp-trunk/wp-includes/template-loader.php' )	../wp-blog-header.php:16
4	0.2351	13741520	include( '/Users/chris/Sites/wp-trunk/wp-content/themes/wp-unframework/index.php' )	../template-loader.php:43
5	0.2578	13820544	Wpu_Functions::post_content( )	../index.php:18
6	0.2640	13833392	get_the_excerpt( )	../functions.php:166
Notice: Trying to get property of non-object in /Users/chris/Sites/wp-trunk/wp-includes/post-template.php on line 268
Call Stack
#	Time	Memory	Function	Location
1	0.0002	231808	{main}( )	../index.php:0
2	0.0003	235024	require( '/Users/chris/Sites/wp-trunk/wp-blog-header.php' )	../index.php:17
3	0.2340	13729696	require_once( '/Users/chris/Sites/wp-trunk/wp-includes/template-loader.php' )	../wp-blog-header.php:16
4	0.2351	13741520	include( '/Users/chris/Sites/wp-trunk/wp-content/themes/wp-unframework/index.php' )	../template-loader.php:43
5	0.2838	13839360	Wpu_Functions::post_content( )	../index.php:18
6	0.2839	13839504	get_the_excerpt( )	../functions.php:166

Attachments (1)

21797.patch (443 bytes) - added by c3mdigital 12 years ago.

Download all attachments as: .zip

Change History (4)

@c3mdigital
12 years ago

#1 @SergeyBiryukov
12 years ago

  • Description modified (diff)
  • Milestone changed from Awaiting Review to 3.5

Related: [21735] (for #21309).

#2 @Ipstenu
12 years ago

  • Severity changed from minor to major

Tested and works :) Makes my custom excerpts come back nicely ;)

Bumping severity since this 'bug' also caused the_excerpt() to totally ignore any and all custom excerpts. Which is teh bad.

#3 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [21767]:

Restore in get_the_excerpt(). Props c3mdigital. fixes #21797

Note: See TracTickets for help on using tickets.