[wp-trac] [WordPress Trac] #21971: Checking for Server Protocol causes PHP notices

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 22 22:16:46 UTC 2012


#21971: Checking for Server Protocol causes PHP notices
-----------------------------+------------------------------
 Reporter:  omarabid         |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Warnings/Notices
  Version:  3.4.2            |   Severity:  minor
 Keywords:                   |
-----------------------------+------------------------------
 I'm debugging my WordPress App. through the PHPStorm Debugger which is not
 a Browser but a simple compiler of the PHP code.

 WordPress checks for two global variables without checking that they are
 defined, which causes an annoying notice in the Debugger.

 The file: ''wp-includes/functions.php''

 The function: ''status_header()''

 The solution is simply to check that the variable is defined

 {{{
     if (isset($_SERVER["SERVER_PROTOCOL"])) {
         $protocol = $_SERVER["SERVER_PROTOCOL"];
     } else {
         $protocol = null;
     }
 }}}

 The same problem for the function ''redirect_canonical()''.

 A simple ''isset()'' check will get rid of this annoyance.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21971>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list