ZF-10284: Method Zend_View_Helper_HeadTitle::setDefaultAttachOrder() don't return $this

Description

The method Zend_View_Helper_HeadTitle::setDefaultAttachOrder() don't return $this object, which throws a fatal error with some use cases.

This code works well :


<?php
$view->headTitle($view->translate('CORE_SiteTitle'))
    ->setSeparator(' - ')
    ->setDefaultAttachOrder(Zend_View_Helper_Placeholder_Container_Abstract::PREPEND)
;

This code throws a fatal error :


<?php
$view->headTitle($view->translate('CORE_SiteTitle'))
    ->setDefaultAttachOrder(Zend_View_Helper_Placeholder_Container_Abstract::PREPEND)
    ->setSeparator(' - ')
;

I made a little fixing patch :


Index: lib/Zend/View/Helper/HeadTitle.php
===================================================================
--- lib/Zend/View/Helper/HeadTitle.php  (revision 22655)
+++ lib/Zend/View/Helper/HeadTitle.php  (working copy)
@@ -105,6 +105,8 @@
             throw new Zend_View_Exception("You must use a valid attach order: 'PREPEND', 'APPEND' or 'SET'");
         }
         $this->_defaultAttachOrder = $setType;
+
+        return $this;
     }
 
     /**

Regards

Greg

Comments

I believe it is an improvement and not a bug.

Fixed with r22879. Thanks by your report.