[mythtv-commits] Ticket #1131: PHP warnings generated by mythweb (svn version 8729) on some versions of PHP on FC4

MythTV mythtv at cvs.mythtv.org
Fri Jan 27 10:48:07 UTC 2006


#1131: PHP warnings generated by mythweb (svn version 8729) on some versions of
PHP on FC4
-------------------------------+--------------------------------------------
 Reporter:  bob at wookey.org.uk  |       Owner:  xris   
     Type:  patch              |      Status:  new    
 Priority:  minor              |   Milestone:  unknown
Component:  mythweb            |     Version:  head   
 Severity:  medium             |  
-------------------------------+--------------------------------------------
 Many distros ship PHP with the error_report variable set to E_ALL. This
 causes a problem with later versions of PHP when they try to key into an
 array with a non-existent key. This causes PHP to insert a complaint into
 the PHP stream BEFORE the headers are sent, completely screwing things.
 One solution, of course would be to tell PHP not to display errors, but a
 better solution is to test for the key's existence before attempting to
 use it. I have produced a simple patch to ...mythweb/includes/init.php as
 follows. I have used the function ''array_key_exists'' which was
 introduced with PHP 4.1, so the patch as posted won't work with older
 versions. If compatibility with earlier versions of PHP is needed then I
 can supply an equivalent function with full backwards compatibility if
 needed.

 Oh, I'm using PHP 4.3.10 which is the latest official release for Fedora
 Core 4.

 Hope this is of some use.

 -Bob

 PS. This is my first submission, so apologies if I did anything
 (everything!) wrong.


 === The Patch ===
 {{{
 --- includes/init.php   (revision 8729)
 +++ includes/init.php   (working copy)
 @@ -8,7 +8,7 @@
   *
   * @url         $URL$
   * @date        $Date$
 - * @version     $Revision$
 + * @version     $Revision: 8649 $
   * @author      $Author$
   * @license     GPL
   *
 @@ -27,11 +27,15 @@
      global $Path;
      $Path = explode('/', preg_replace('/^\/+/',   '',    // Remove
 leading slashes
                           preg_replace('/[\s]+/', ' ',    // Convert extra
 whitespace
 -                             $_SERVER['PATH_INFO']       // Grab the path
 info from various different places.
 +                             array_key_exists('PATH_INFO', $_SERVER)
 +                                                         // Grab the path
 info from various different places.
                                  ? $_SERVER['PATH_INFO']
 -                                : ($_ENV['PATH_INFO']
 +                                : (array_key_exists('PATH_INFO', $_ENV)
                                      ? $_ENV['PATH_INFO']
 -                                    : $_GET['PATH_INFO']
 +                                    : (array_key_exists('PATH_INFO',
 $_GET)
 +                                         ? $_GET['PATH_INFO']
 +                                         : ''
 +                                      )
                                    )
                           ))
                     );
 }}}

-- 
Ticket URL: <http://cvs.mythtv.org/trac/ticket/1131>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list