FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » bug in is_numeric
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: bug in is_numeric [message #181360 is a reply to message #181352] Mon, 13 May 2013 17:55 Go to previous messageGo to previous message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma:
Senior Member
On 13/05/13 16:15, fred wrote:

> Otherwise I'm done repeating myself.
>>> if(is_numeric('x11.11c') returns TRUE
>>> and variations eg: z1111x is also true
> >
>> Could you try the following code and let me know what comes out?
>> <?php $a = is_numeric('x11.11c'); var_dump($a); ?>
>
> OK I get false when I do that.
> "bool(false)" to be more precise.
> var_export($a)also reports false if thats any help.
>
> I have just typed in an exact copy of the test in my message of 02:58pm
> When you have run that on an apache PHP installation of the same version
> PHP as I listed (5.3.6) under windows7-64 bit - get back to me.

Apparently there is nothing wrong with your is_numeric() as you state
var_export did return "bool(false)" which is the expected result.

you fail to show the code you actually used (the example you gave don't
have correct syntax, so I doubt it's from your actual code, just
something you wrote).

As other already pointed out, you are most likely expecting a specific
value to been set, but most likely it's another value (bad coding which
uses "global" values which are used in many functions will in most cases
have a more random nature of what value it will have) or that your
if-statement includes a negation for example:

if(!is_numeric("abcdef")) {
echo "my code is buggy, not is_numeric()\n";
}

By the way, var_export() don't return false, it will return null by
default or a string (if you set the return argument to true).
If you made a check on what var_export() returned and you got it to be
equal to false, then your method of checking the return value is utterly
flawed.

The release of PHP 5.3.6 is over two years ago, and if there had been a
bug, then it had been discovered a lot earlier than now on a function
which is heavily used in a lot of PHP code and the code base isn't
platform dependent.

My recommendation would be to upgrade to 5.4.14, if you can't find it
for your OS, then upgrade to one which provides it.

--

//Aho
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem encrypting data (AES_ENCRYPT/AES_DECRYPT)
Next Topic: Debian: php fast-cgi along with mod_php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 07:07:46 GMT 2024

Total time taken to generate the page: 0.04451 seconds