Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.3

Bug #1969 $strHtml not initialized if not using frameset doctype variant
Submitted: 2004-07-23 20:58 UTC Modified: 2004-07-24 08:29 UTC
From: matte at silent-e dot com Assigned: thesaur
Status: Closed Package: HTML_Page2
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-23 20:58 UTC] matte at silent-e dot com
Description: ------------ Line 579 (of CVS version 1.9) adds onto the variable $strHtml. The problem is the block of code immediately before it. If we're not using a frameset then $strHtml never gets initialized. Reproduce code: --------------- Bad code: if ($this->_doctype['variant'] == 'frameset') { $this->_tabOffset++; $tabs = $this->_getTabs(); $strHtml = $tabs . '<noframes>' . $lnEnd; $this->_tabOffset++; $tabs = $this->_getTabs(); } if ($strAttr) { $strHtml .= $tabs . "<body $strAttr>" . $lnEnd; } else { $strHtml .= $tabs . '<body>' . $lnEnd; } Fixed code: if ($this->_doctype['variant'] == 'frameset') { $this->_tabOffset++; $tabs = $this->_getTabs(); $strHtml = $tabs . '<noframes>' . $lnEnd; $this->_tabOffset++; $tabs = $this->_getTabs(); } else { $strHtml = ''; } Expected result: ---------------- no errors. :) Actual result: -------------- Notice: Undefined variable: strHtml in /path/to/PEAR/HTML/Page2.php on line 579

Comments

 [2004-07-24 05:26 UTC] thesaur
Good point. I will change that this afternoon. Also, bug #1913 is related to this code section ($this->doctype['variant'] is not set for XHTML 1.1, and therefore there must be an isset check). I will also fix that this afternoon.
 [2004-07-24 08:29 UTC] thesaur
This has been fixed in CVS. A new release will be coming soon. Thanks for helping me make this package better. :-)