Skip to content

Commit 389d285

Browse files
hikari-no-yumenikic
authored andcommitted
Special-case aliases, add warning comments to implementations
1 parent 5fc0006 commit 389d285

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

Zend/zend_builtin_functions.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ ZEND_FUNCTION(func_get_args)
519519
/* }}} */
520520

521521
/* {{{ proto int strlen(string str)
522-
Get string length */
522+
Get string length
523+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
523524
ZEND_FUNCTION(strlen)
524525
{
525526
zend_string *s;
@@ -776,7 +777,8 @@ ZEND_FUNCTION(define)
776777

777778

778779
/* {{{ proto bool defined(string constant_name)
779-
Check whether a constant exists */
780+
Check whether a constant exists
781+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
780782
ZEND_FUNCTION(defined)
781783
{
782784
zend_string *name;

Zend/zend_compile.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,9 +4274,15 @@ int zend_try_compile_special_func(
42744274
return zend_compile_func_typecheck(result, args, IS_NULL TSRMLS_CC);
42754275
} else if (zend_string_equals_literal(lcname, "is_bool")) {
42764276
return zend_compile_func_typecheck(result, args, _IS_BOOL TSRMLS_CC);
4277-
} else if (zend_string_equals_literal(lcname, "is_long")) {
4277+
} else if (zend_string_equals_literal(lcname, "is_long")
4278+
|| zend_string_equals_literal(lcname, "is_int")
4279+
|| zend_string_equals_literal(lcname, "is_integer")
4280+
) {
42784281
return zend_compile_func_typecheck(result, args, IS_LONG TSRMLS_CC);
4279-
} else if (zend_string_equals_literal(lcname, "is_float")) {
4282+
} else if (zend_string_equals_literal(lcname, "is_float")
4283+
|| zend_string_equals_literal(lcname, "is_double")
4284+
|| zend_string_equals_literal(lcname, "is_real")
4285+
) {
42804286
return zend_compile_func_typecheck(result, args, IS_DOUBLE TSRMLS_CC);
42814287
} else if (zend_string_equals_literal(lcname, "is_string")) {
42824288
return zend_compile_func_typecheck(result, args, IS_STRING TSRMLS_CC);

ext/standard/basic_functions.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4714,7 +4714,8 @@ PHP_FUNCTION(error_get_last)
47144714
/* }}} */
47154715

47164716
/* {{{ proto mixed call_user_func(mixed function_name [, mixed parmeter] [, mixed ...])
4717-
Call a user function which is the first parameter */
4717+
Call a user function which is the first parameter
4718+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
47184719
PHP_FUNCTION(call_user_func)
47194720
{
47204721
zval retval;
@@ -4741,7 +4742,8 @@ PHP_FUNCTION(call_user_func)
47414742
/* }}} */
47424743

47434744
/* {{{ proto mixed call_user_func_array(string function_name, array parameters)
4744-
Call a user function which is the first parameter with the arguments contained in array */
4745+
Call a user function which is the first parameter with the arguments contained in array
4746+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
47454747
PHP_FUNCTION(call_user_func_array)
47464748
{
47474749
zval *params, retval;

ext/standard/type.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,23 +243,26 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
243243

244244

245245
/* {{{ proto bool is_null(mixed var)
246-
Returns true if variable is null */
246+
Returns true if variable is null
247+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
247248
PHP_FUNCTION(is_null)
248249
{
249250
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_NULL);
250251
}
251252
/* }}} */
252253

253254
/* {{{ proto bool is_resource(mixed var)
254-
Returns true if variable is a resource */
255+
Returns true if variable is a resource
256+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
255257
PHP_FUNCTION(is_resource)
256258
{
257259
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_RESOURCE);
258260
}
259261
/* }}} */
260262

261263
/* {{{ proto bool is_bool(mixed var)
262-
Returns true if variable is a boolean */
264+
Returns true if variable is a boolean
265+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
263266
PHP_FUNCTION(is_bool)
264267
{
265268
zval *arg;
@@ -274,39 +277,44 @@ PHP_FUNCTION(is_bool)
274277
/* }}} */
275278

276279
/* {{{ proto bool is_long(mixed var)
277-
Returns true if variable is a long (integer) */
280+
Returns true if variable is a long (integer)
281+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
278282
PHP_FUNCTION(is_long)
279283
{
280284
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG);
281285
}
282286
/* }}} */
283287

284288
/* {{{ proto bool is_float(mixed var)
285-
Returns true if variable is float point*/
289+
Returns true if variable is float point
290+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
286291
PHP_FUNCTION(is_float)
287292
{
288293
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE);
289294
}
290295
/* }}} */
291296

292297
/* {{{ proto bool is_string(mixed var)
293-
Returns true if variable is a string */
298+
Returns true if variable is a string
299+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
294300
PHP_FUNCTION(is_string)
295301
{
296302
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
297303
}
298304
/* }}} */
299305

300306
/* {{{ proto bool is_array(mixed var)
301-
Returns true if variable is an array */
307+
Returns true if variable is an array
308+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
302309
PHP_FUNCTION(is_array)
303310
{
304311
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY);
305312
}
306313
/* }}} */
307314

308315
/* {{{ proto bool is_object(mixed var)
309-
Returns true if variable is an object */
316+
Returns true if variable is an object
317+
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
310318
PHP_FUNCTION(is_object)
311319
{
312320
php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT);

0 commit comments

Comments
 (0)