[wp-trac] [WordPress Trac] #21797: get_the_excerpt() causing PHP notices. Undefined variable $post and Trying to get property of non object

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 5 01:39:32 UTC 2012


#21797: get_the_excerpt() causing PHP notices. Undefined variable $post and Trying
to get property of non object
------------------------------+--------------------
 Reporter:  c3mdigital        |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  3.5
Component:  Warnings/Notices  |     Version:  trunk
 Severity:  minor             |  Resolution:
 Keywords:  has-patch         |
------------------------------+--------------------
Changes (by SergeyBiryukov):

 * milestone:  Awaiting Review => 3.5


Old description:

> In 21759 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
> }}}

New description:

 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
 }}}

--

Comment:

 Related: [21735] (for #21309).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21797#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list