ZF-221: Zend_Filter::isDigits() operates erratically

Issue Type: Bug Created: 2006-07-10T15:53:33.000+0000 Last Updated: 2011-07-26T11:36:42.000+0000 Status: Resolved Fix version(s): - 0.2.0 (29/Oct/06)

Reporter: Matthew Ratzloff (mratzloff) Assignee: Mark Evans (sparky) Tags: - Zend_Filter

Related issues: - ZF-11610



Zend_Filter::isDigits() sometimes returns false on values that are digits. The solution is simple:

<pre class="highlight">
public static function isDigits($value)
---    return ctype_digit($value);
+++    return ctype_digit((string) $value);

I marked this major because I use this for all ID validation in my applications.


Posted by Mark Evans (sparky) on 2006-07-12T05:00:04.000+0000

Can you give some examples where it fails?

Posted by Matthew Ratzloff (mratzloff) on 2006-07-12T10:17:12.000+0000

{quote} Fatal error: Uncaught exception 'Exception' with message 'Expected second ID' in /path/to/ExampleController.php:312 Stack trace:

0 /path/to/ExampleController.php(184): ExampleController->doSomething('7', 19)[...]


<pre class="highlight">
public function doSomething($firstId, $secondId)
        throw new Exception("Expected first ID");

        throw new Exception("Expected second ID");

Changing Zend_Filter::isDigits() as indicated results in correct execution. See….

You might also change to

which is what I went ahead and did.



Posted by Matthew Ratzloff (mratzloff) on 2006-07-12T10:22:17.000+0000

I meant to say see the last two comments of […](

So much for dynamic typing. :-) A bug in PHP?



Have you found an issue?

See the Overview section for more details.


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

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