ZF-12044: Placeholder with no items but prefix set should render no content


If you have set a prefix/postfix to a placeholder, but do not assign any items, there is still output rendered when this placeholder is called. My desired behavior was to have no output if there were no items.

Altering the toString function in Zend_View_Helper_Placeholder_Container_Abstract by altering the call to copy the item array


public function toString($indent = null)
    $indent = ($indent !== null)
            ? $this->getWhitespace($indent)
            : $this->getIndent();

    if(!$items  = $this->getArrayCopy()) { return ''; }
    $return = $indent
            . $this->getPrefix()
            . implode($this->getSeparator(), $items)
            . $this->getPostfix();
    $return = preg_replace("/(\r\n?|\n)/", '$1' . $indent, $return);
    return $return;



Fixed on trunk (25254) and release-1.12 (25255)