Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Apply patch from bug #950 (correct iterative recursion)

git-svn-id: http://svn.php.net/repository/pear/packages/HTML_Page/trunk@154529 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 449ab77810d19278ba19a454a0cae426ab40cb23 1 parent 7ba73f2
Klaus Guenther authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 Page.php
View
18 Page.php
@@ -346,15 +346,14 @@ function HTML_Page($attributes = array())
* extend HTML_Common.
*
* @access protected
- * @param array $array The array to be processed
+ * @param mixed $element The element to be processed
* @return string
*/
- function _arrayToHtml(&$array) // It's a reference just to save some memory.
+ function _elementToHtml(&$element) // It's a reference just to save some memory.
{
$lnEnd = $this->_getLineEnd();
$tab = $this->_getTab();
$strHtml = '';
- foreach ($array as $element) {
if (is_object($element)) {
if (is_subclass_of($element, 'html_common')) {
$element->setTabOffset(1);
@@ -363,21 +362,22 @@ function _arrayToHtml(&$array) // It's a reference just to save some memory.
}
if (is_object($element)) {
if (method_exists($element, 'toHtml')) {
- $strHtml .= $element->toHtml() . $lnEnd;
+ $strHtml .= $this->_elementToHtml($element->toHtml()) . $lnEnd;
} elseif (method_exists($element, 'toString')) {
- $strHtml .= $element->toString() . $lnEnd;
+ $strHtml .= $this->_elementToHtml($element->toString()) . $lnEnd;
}
} else {
$strHtml .= $tab . $element . $lnEnd;
}
} elseif (is_array($element)) {
- $strHtml .= $this->_arrayToHtml($element);
+ foreach ($element as $item) {
+ $strHtml .= $this->_elementToHtml($item);
+ }
} else {
$strHtml .= $tab . $element . $lnEnd;
}
- }
return $strHtml;
- } // end func _arrayToHtml
+ } // end func _elementToHtml
/**
* Generates the HTML string for the <body< tag
@@ -404,7 +404,7 @@ function _generateBody()
// Allow for mixed content in the body array, recursing into inner
// array serching for non-array types.
- $strHtml .= $this->_arrayToHtml($this->_body);
+ $strHtml .= $this->_elementToHtml($this->_body);
// Close tag
$strHtml .= '</body>' . $lnEnd;
Please sign in to comment.
Something went wrong with that request. Please try again.