Issues

ZF-3577: simple optimizing toString functions

Issue Type: Performance Improvement Created: 2008-07-04T02:23:22.000+0000 Last Updated: 2008-11-13T14:10:00.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Marc Bennewitz (GIATA mbH) (mben) Assignee: Jon Whitcraft (sidhighwind) Tags: - Zend_View

Related issues: - ZF-4608

Attachments:

Description

escape the output string after the string was generated if no tags are included in the string

e.g: Zend_View_Helper_HeadTitle

<pre class="highlight">
    public function toString($indent = null)
    {
        $indent = (null !== $indent)
                ? $this->getWhitespace($indent)
                : $this->getIndent();

        $items = array();
        foreach ($this as $item) {
            $items[] = $this->_escape($item);
        }

        $separator = $this->_escape($this->getSeparator());

        return $indent . '' . implode($separator, $items) . '';
    }

the escape function need only one call

<pre class="highlight">
    public function toString($indent = null)
    {
        $indent = (null !== $indent)
                ? $this->getWhitespace($indent)
                : $this->getIndent();

        $items = array();
        foreach ($this as $item) {
            $items[] = $item;  // rem escpae
        }

        $separator = $this->getSeparator();  // rem escape

        return $indent . '' . $this->escape( implode($separator, $items) ) . '';  // add escape
    }

Comments

Posted by Jon Whitcraft (sidhighwind) on 2008-10-28T15:30:15.000+0000

Fixed in r12174.

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:00.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts