Browse Source

MFB: Fixed bug #28800 (strings beginning with "inf" improperly converted).

PHP-5.1
Ilia Alshanetsky 22 years ago
parent
commit
6dd2613d7b
  1. 2
      Zend/zend_operators.h
  2. 17
      tests/lang/bug28800.phpt

2
Zend/zend_operators.h

@ -87,6 +87,8 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
*lval = local_lval;
}
return IS_LONG;
} else if (end_ptr_long == str && *end_ptr_long != '\0') { /* ignore partial string matches */
return 0;
}
} else {
end_ptr_long=NULL;

17
tests/lang/bug28800.phpt

@ -0,0 +1,17 @@
--TEST--
Bug #28800 (Incorrect string to number conversion for strings starting with 'inf')
--FILE--
<?php
$strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable');
foreach ($strings as $v) {
echo ($v+0)."\n";
}
?>
--EXPECT--
0
0
0
0
0
0
Loading…
Cancel
Save