[wp-trac] [WordPress Trac] #42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284

WordPress Trac noreply at wordpress.org
Thu Mar 28 19:08:23 UTC 2019


#42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
-------------------------------------------------+-------------------------
 Reporter:  internetwerk                         |       Owner:
                                                 |  boonebgorges
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.2
Component:  Posts, Post Types                    |     Version:  4.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  dev-feedback has-patch 2nd-opinion   |     Focuses:
  php73 has-unit-tests                           |
-------------------------------------------------+-------------------------
Changes (by spacedmonkey):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 After testing your unit test @davidbinda I have confirmed it is invalid. I
 am not sure how was it working before, it is invalid. For that test to
 pass it would need to the global $post object. The test would have to look
 like this

 {{{#!php
         /**
          * @ticket 42814
          */
         public function
 test_ge_the_content_after_setup_postdata_without_global_post() {
                 global $post;
                 $p1 = self::factory()->post->create_and_get(
                         array(
                                 'post_content' => 'Foo',
                         )
                 );

                 $post_object = get_post( $p1->ID );
                 $post = $post_object;
                 setup_postdata( $post_object );

                 $this->assertSame( 'Foo', get_the_content() );
         }

 }}}

 For that reason, I am re-closing this ticket.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42814#comment:102>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list