Browse Source

Deprecate is_real() function

pull/4457/head
Nikita Popov 6 years ago
parent
commit
4e190691e2
  1. 1
      Zend/zend_compile.c
  2. 2
      ext/standard/basic_functions.c
  3. 8
      ext/standard/tests/general_functions/is_float.phpt
  4. 8
      ext/standard/tests/general_functions/is_float_64bit.phpt

1
Zend/zend_compile.c

@ -3708,7 +3708,6 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return zend_compile_func_typecheck(result, args, IS_LONG);
} else if (zend_string_equals_literal(lcname, "is_float")
|| zend_string_equals_literal(lcname, "is_double")
|| zend_string_equals_literal(lcname, "is_real")
) {
return zend_compile_func_typecheck(result, args, IS_DOUBLE);
} else if (zend_string_equals_literal(lcname, "is_string")) {

2
ext/standard/basic_functions.c

@ -3109,7 +3109,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FALIAS(is_integer, is_int, arginfo_is_int)
PHP_FALIAS(is_long, is_int, arginfo_is_int)
PHP_FALIAS(is_double, is_float, arginfo_is_float)
PHP_FALIAS(is_real, is_float, arginfo_is_float)
PHP_DEP_FALIAS(is_real, is_float, arginfo_is_float)
PHP_FE(is_numeric, arginfo_is_numeric)
PHP_FE(is_string, arginfo_is_string)
PHP_FE(is_array, arginfo_is_array)

8
ext/standard/tests/general_functions/is_float.phpt

@ -51,7 +51,7 @@ foreach ($floats as $float ) {
echo "-- Iteration $loop_counter --\n"; $loop_counter++;
var_dump( is_float($float) );
var_dump( is_double($float) );
var_dump( is_real($float) );
var_dump( @is_real($float) );
}
echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
@ -124,7 +124,7 @@ foreach ($not_floats as $value ) {
echo "--Iteration $loop_counter--\n"; $loop_counter++;
var_dump( is_float($value) );
var_dump( is_double($value) );
var_dump( is_real($value) );
var_dump( @is_real($value) );
}
echo "\n*** Testing error conditions ***\n";
@ -426,6 +426,8 @@ bool(false)
Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
Deprecated: Function is_real() is deprecated in %s on line %d
Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
@ -435,6 +437,8 @@ bool(false)
Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Deprecated: Function is_real() is deprecated in %s on line %d
Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done

8
ext/standard/tests/general_functions/is_float_64bit.phpt

@ -53,7 +53,7 @@ foreach ($floats as $float ) {
echo "-- Iteration $loop_counter --\n"; $loop_counter++;
var_dump( is_float($float) );
var_dump( is_double($float) );
var_dump( is_real($float) );
var_dump( @is_real($float) );
}
echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
@ -126,7 +126,7 @@ foreach ($not_floats as $value ) {
echo "--Iteration $loop_counter--\n"; $loop_counter++;
var_dump( is_float($value) );
var_dump( is_double($value) );
var_dump( is_real($value) );
var_dump( @is_real($value) );
}
echo "\n*** Testing error conditions ***\n";
@ -423,6 +423,8 @@ bool(false)
Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
Deprecated: Function is_real() is deprecated in %s on line %d
Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
@ -432,6 +434,8 @@ bool(false)
Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Deprecated: Function is_real() is deprecated in %s on line %d
Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
Loading…
Cancel
Save