From 4e190691e2d6a07dd79f3555d4d8d1f26e9f0a11 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 11 Jul 2019 17:18:01 +0200 Subject: [PATCH] Deprecate is_real() function --- Zend/zend_compile.c | 1 - ext/standard/basic_functions.c | 2 +- ext/standard/tests/general_functions/is_float.phpt | 8 ++++++-- ext/standard/tests/general_functions/is_float_64bit.phpt | 8 ++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 7570e39dfe..40b29058bc 100644 --- a/Zend/zend_compile.c +++ b/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")) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 0e11c1c088..42815ca6f1 100644 --- a/ext/standard/basic_functions.c +++ b/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) diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index cec0e445ab..6d4ada6701 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/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 diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index 38fc52675f..be5843a7d5 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/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 -- 2.50.0