Home » HTML » HTML_Page2 » Bug #1969
$strHtml not initialized if not using frameset doctype variant
Details
| Submitted | 2004-07-24 01:58 UTC |
|---|---|
| From | matte at silent-e dot com |
| Assigned | thesaur |
| Status | Closed |
| Package | HTML_Page2 |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-07-24 01: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