Login   Register  
PHP Classes
elePHPant
Icontem

Unset variable $dirname on line 242 produces output

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      dUnzip2  >  All threads  >  Unset variable $dirname on line 242 produces output  >  (Un) Subscribe thread alerts  
Subject:Unset variable $dirname on line 242 produces output
Summary:PHP classes should be authored with the maximum error reporting
Messages:1
Author:Ben Johnson
Date:2010-07-29 17:08:24
 

  1. Unset variable $dirname on line 242 produces output   Reply  
Picture of Ben Johnson
Ben Johnson
2010-07-29 17:08:24
Line 242 of dUnzip2.inc.php is:

$dirname = ($dirname!='.')?dirname($fileName):'';

When PHP error reporting is configured to report warnings, this line produces output (because it is possible for $dirname not to be set). For this reason, un-zipping a file and then redirecting with header() fails in such situations. The fix would be to set $dirname to an empty string before this line, or suppress the warning with the @ operator:

$dirname = @($dirname!='.')?dirname($fileName):'';