Issues

ZF-6212: render function throws InvalidArgumentException

Issue Type: Coding Standards Violation Created: 2009-04-04T19:39:37.000+0000 Last Updated: 2011-06-23T06:59:04.000+0000 Status: Closed Fix version(s): Reporter: old of Satoru Yoshida (yoshida@zend.co.jp) Assignee: Udo Telaar (udo) Tags: - Zend_Text_Figlet

Related issues: - ZF-5035

Attachments: - fix_ZF-6212.diff

Description

I find InvalidArgumentException in render()

<pre class="highlight">
    public function render($text, $encoding = 'UTF-8')
    {
        if (!is_string($text)) {
            throw new InvalidArgumentException('$text must be a string');
        }

No need to change into Zend_Text_Figlet_Exception ??

Comments

Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-04-04T19:41:39.000+0000

I find similar issue.

Posted by Udo Telaar (udo) on 2009-11-20T09:26:55.000+0000

Added class/file InvalidArgumentException and called that instead of the standard PHP InvalidArgumentException.

There are a few other components using the standard PHP exception class. Fix them too?

Posted by Ben Scholzen (dasprid) on 2009-11-20T09:32:01.000+0000

I don't think so, let's take Matthew a look over it before changing anything.

Posted by Matthew Weier O'Phinney (matthew) on 2009-11-20T09:53:05.000+0000

Throwing SPL exceptions is perfectly valid, and in this case, provides better semantic meaning for the exception itself.

Posted by Satoru Yoshida (satoruyoshida) on 2009-11-21T16:03:29.000+0000

Thank all for comments :D . I understand it.

Posted by Kazusuke Sasezaki (sasezaki) on 2009-11-23T16:10:46.000+0000

Throwing SPL's exception, is it against manual? http://framework.zend.com/manual/en/…

Posted by Satoru Yoshida (satoruyoshida) on 2009-11-26T06:47:09.000+0000

Reopen for Mr. Sasezaki. I hear that he could not use reopen command.

Posted by Kazusuke Sasezaki (sasezaki) on 2009-11-26T07:31:01.000+0000

Thanks, Satoru.

I had found similar issue. //in ZF-directory

<pre class="highlight">
grep -r 'throw new' . | grep -v Zend 

Throwing Zend_Exception-instances in ZF-Classes, wasn't it ZF(ver1)'s policy?

Posted by Satoru Yoshida (satoruyoshida) on 2011-06-22T11:36:59.000+0000

Hello, Sasezaki.

Is this issue still active? Or can I close this ?

Regards

Posted by Kazusuke Sasezaki (sasezaki) on 2011-06-22T14:21:42.000+0000

Thanks for comment. As we know currently, ZF2 will implement extends-spl-exception for each components. So, I think this issue can be closed. (But ZF2 is still development!:-) As above Matthew comment, he don't think it is not good that be able not catching every exceptions by Zend_Exception. So that,,, this is not "Coding Standards Violation".

Posted by Satoru Yoshida (satoruyoshida) on 2011-06-23T06:59:04.000+0000

Thank You for quick responce.

Totally I agree, so I will close this once. Thanks.

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