PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Validate » Validate » Bug #1799

is_numeric not trim strings

Details

Submitted2004-07-05 21:06 UTC
Fromvosorio at sinectis dot com dot ar
Assignedpajoye
StatusBogus
PackageValidate
PHP Version4.3.4
OSApache 1.3
Roadmaps(Not assigned)

Comments

[2004-07-05 21:06 UTC] vosorio at sinectis dot com dot ar

Description:
------------
is_numeric not trim strings, in versions before when you've got "123.333 " it's treat like a number, but in version 4.3.4 not !!! the function return false;

Reproduce code:
---------------
if you have that:
$nro="123.32 ";

if (is_numeric($nro)) {
echo "numeric";
}else{
echo "not a numeric";
}

Expected result:
----------------
not a numeric

[2004-07-07 11:26 UTC] vosorio at sinectis dot com dot ar

the problem is that we was developing wiht php 4.2.3 and when you get a value from a "recordset" from an sql query, sometimes the numbers became with spaces after the number and with this new version, that's not work.
i can put it trim inside that function, but is not compatible with older versions of php

[2004-07-07 11:54 UTC] vosorio at sinectis dot com dot ar

i don't understand what you wanna read ...
the problem is for people who started programing with version 4.2.3 and upgrade it to 4.3.4 all the scripts that were written like that return false when before return true ...... the scripts not work unless you put is_numeric(trim($row[0])). do you understand me ?

[2004-07-07 12:20 UTC] pierre at dotgeek dot org

http://www.php.net/is_numeric

this is php itself, not PEAR::Validate.

If there is a problem inside valide, please provide a short script to reproduce it.

--Pierre

[2004-07-07 12:20 UTC] pierre at dotgeek dot org

Sorry, but your problem does not imply a bug in PEAR itself. For a
list of more appropriate places to ask for help using PEAR, please
visit http://pear.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.

Thank you for your interest in PEAR.

Change state