[wp-trac] [WordPress Trac] #46719: fastcgi_finish_request usage in wp-cron.php and 3party plugins

WordPress Trac noreply at wordpress.org
Sun Mar 31 22:23:45 UTC 2019


#46719: fastcgi_finish_request usage in wp-cron.php and 3party plugins
--------------------------+------------------------
 Reporter:  Rahe          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Cron API      |     Version:  5.1
 Severity:  minor         |  Resolution:  duplicate
 Keywords:                |     Focuses:
--------------------------+------------------------
Changes (by peterwilsoncc):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Awaiting Review =>


Comment:

 I'm going to close this as a duplicate of #46417 as it also discusses
 sending headers after the `fastcgi_finish_request()` call.

 wp-cron.php is intended to execute PHP code on a non-interactive loopback
 request. To prevent headers being sent on wp-cron, it's recommended to
 check `headers_sent()` beforehand:

 {{{#!php
 <?php
 if ( ! headers_sent() ) {
         header( 'X-Ticket: 46719' );
         // or redirects, starting sessions, setting cookies, etc.
 }
 }}}

 In the case of this particular plugin, a custom endpoint or admin page is
 the recommended approach. Site users should not be sent to wp-cron.php and
 expect output.

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


More information about the wp-trac mailing list