diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-23 16:33:24 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-09-23 16:39:52 +0200 |
commit | 3012d006ff4da73679fca9f0d78a82492fcd0b7a (patch) | |
tree | 8a8d552b816ff7ccc5ea15411929a92c335c050a /ext/reflection/php_reflection.c | |
parent | e441378b5422908474863a34cfa6f983a536ce5c (diff) | |
download | php-git-3012d006ff4da73679fca9f0d78a82492fcd0b7a.tar.gz |
Don't set nullability flag for parameters without type
Use value 0 instead. To compensate we check in ReflectionParameter
allowsNull() whether the type is set at all: If it isn't, it always
allows null.
This removes a discrepancy between internal&userland functions:
For userland functions allowsNull() on untyped parameters returned
true, but for internal functions it returned false.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6273c56def..92723240e9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2593,7 +2593,8 @@ ZEND_METHOD(reflection_parameter, allowsNull) } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); + RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type) + || ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); } /* }}} */ |