-- Ian Warner <iwar...@triangle-solutions.com> wrote
(on Monday, 16 November 2009, 10:34 PM +0900):
> Stefan
> 
> Spot on
> 
> However I get this error now:
> Fatal error: Call to undefined method
> Zend_View_Helper_Placeholder_Container::ksort() in
> /content/pringlus/docs/conga/library/Zend/View/Helper/HeadLink.php on
> line 311

This will happen pre 5.2.0 as well, IIRC; ArrayObject only added it at
that point.

> In the toString method:
> 
>     public function toString($indent = null)
>     {
>         $indent = (null !== $indent)
>                 ? $this->getWhitespace($indent)
>                 : $this->getIndent();
> 
>         $items = array();
>         $this->getContainer()->ksort();
>         foreach ($this as $item) {
>             $items[] = $this->itemToString($item);
>         }
> 
>         return $indent . implode($this->_escape($this->getSeparator())
> . $indent, $items);
>     }
> 
> Ian
> 
> 
> 2009/11/16 Stefan Gehrig <geh...@ishd.de>:
> > The problem is that you're doing
> >
> > echo $this->headScript() . PHP_EOL;
> >                         ^
> >                         |
> > that's a concatenation --+
> >
> > That's effectively "concat the result from $this->headScript() with an 
> > PHP_EOL and echo the result".
> > Therefore this is not strictly considered "directly combined with echo() or 
> > print()".
> >
> > You'd have to do:
> > echo $this->headScript();
> > echo PHP_EOL;
> >
> > Best regards
> >
> > Stefan
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
> > Gesendet: Montag, 16. November 2009 12:48
> > An: Stefan Gehrig
> > Betreff: Re: [fw-general] Issues with $this->headScript()
> >
> > Stefan
> >
> > appreciate that, indeed this server has 5.1.x on it
> >
> > However I am doing
> > echo $this->headScript() . PHP_EOL;
> >
> > therefore from the instructions:
> >
> > "It is worth noting that before PHP 5.2.0 the __toString method was
> > only called when it was directly combined with echo() or print()"
> >
> > am I not doiing this correctly?
> >
> > 2009/11/16 Stefan Gehrig <geh...@ishd.de>:
> >> Hi Ian,
> >>
> >> please check your PHP version...
> >>
> >> It is worth noting that before PHP 5.2.0 the __toString method was only 
> >> called when it was directly combined with echo() or print(). Since PHP 
> >> 5.2.0, it is called in any string context (e.g. in printf() with %s 
> >> modifier) but not in other types contexts (e.g. with %d modifier). [...]
> >> http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
> >>
> >> __toString will not be called in concatenation-operations prior to PHP 
> >> 5.2.0.
> >>
> >> Best regards
> >>
> >> Stefan
> >>
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
> >> Gesendet: Montag, 16. November 2009 12:28
> >> An: Zend Framework
> >> Betreff: [fw-general] Issues with $this->headScript()
> >>
> >> Hi
> >>
> >> When I use:
> >> echo $this->headScript() . PHP_EOL;
> >>
> >>
> >> All that prints out is:
> >> Object id #99
> >>
> >> This is a new and unfamiliar server I am deploying on so could be
> >> anything - but any pointed gratefully received
> >>
> >> Ian
> >>
> >>
> >
> >
> 

-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/

Reply via email to