[Tickets #12612] Re: > This will break with $year is not a string type. ctype_int *requires*  > the input value to be typed as a string and will return unexpected  > results when it is passed an integer (as the phpdoc says this method  > takes).  oh, thanks for catching this.
    noreply at bugs.horde.org 
    noreply at bugs.horde.org
       
    Sat Aug 24 19:49:37 UTC 2013
    
    
  
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/12612
------------------------------------------------------------------------------
  Ticket             | 12612
  Updated By         | Thomas Jarosch <thomas.jarosch at intra2net.com>
-Summary            | Horde_Date: Replace simple regex with ctype_digit()
+Summary            | > This will break with $year is not a string type.
                     | ctype_int *requires*  > the input value to be typed as
                     | a string and will return unexpected  > results when it
                     | is passed an integer (as the phpdoc says this method  >
                     | takes).  oh, thanks for catching this.
  Queue              | Horde Framework Packages
  Version            | Git master
  Type               | Bug
-State              | Feedback
+State              | Not A Bug
  Priority           | 1. Low
  Milestone          |
  Patch              | 1
  Owners             |
------------------------------------------------------------------------------
Thomas Jarosch <thomas.jarosch at intra2net.com> (2013-08-24 19:49) wrote:
> This will break with $year is not a string type. ctype_int  
> *requires* the input value to be typed as a string and will return  
> unexpected results when it is passed an integer (as the phpdoc says  
> this method takes).
oh, thanks for catching this. The doc even says "may not return the  
expected result.".
> $year must be explicitly cast to string before being passed to  
> ctype_int If indeed it is more efficient than to just use the simple  
> regex.
I measured the first part of the function with 10.000.000 invocations.
The speed gain is 0.1s -> Not worth the trouble.
    
    
More information about the bugs
mailing list