PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_Page2 » Bug #1969

$strHtml not initialized if not using frameset doctype variant

Details

Submitted2004-07-24 01:58 UTC
Frommatte at silent-e dot com
Assignedthesaur
StatusClosed
PackageHTML_Page2
PHP VersionIrrelevant
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