-- AmirBehzad Eslami <[EMAIL PROTECTED]> wrote
(on Friday, 01 February 2008, 07:07 PM +0330):
> I just found the following note in PHP Manual (@see: entry for is_int())
> 
> Note:
> 
> To test if a variable is a number or a numeric string (such as form input,
> which is always a string), you must use is_numeric().

The problem with is_numeric is that floats also evaluate to true -- and
we don't want floats. So, casting explicitly to integer *prior* to
testing is a safer and saner approach for us.

> OK. I'll place an issue in the tracker.

Great, thanks -- I'll keep an eye out for it.

> Thank you for your attention.

My pleasure!

> On Feb 1, 2008 6:18 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> 
>     -- AmirBehzad Eslami <[EMAIL PROTECTED]> wrote
>     (on Friday, 01 February 2008, 05:47 PM +0330):
>     > >> My understanding is
>     > >> that PHP will convert it to an integer before sending it anyways.
>     >
>     > No. In my experience an exception thrown
>     > @see: Controller/Response/Abstract.php , Line 230
>     >
>     >         if (!is_int($code) || (100 > $code) || (599 < $code)) {
>     >             require_once 'Zend/Controller/Response/Exception.php';
>     >             throw new Zend_Controller_Response_Exception('Invalid HTTP
>     response
>     > code');
>     >         }
> 
>     So, what I'm thinking is that instead of checking for is_int(), we
>     should cast to int prior to any other checks. That way, both '303' and
>     303 will work, and users don't need to be worried about the specific
>     type they send.
> 
>     Can you place an issue in the tracker for this?

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to