mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Add Z_PARAM_RESOURCE_OR_NULL()
As a more explicit alternative to Z_PARAM_RESOURCE_EX(, 1, 0).
This commit is contained in:
parent
d030ddb2cd
commit
2d1bf6970d
3 changed files with 14 additions and 11 deletions
|
@ -1517,6 +1517,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num
|
|||
#define Z_PARAM_RESOURCE(dest) \
|
||||
Z_PARAM_RESOURCE_EX(dest, 0, 0)
|
||||
|
||||
#define Z_PARAM_RESOURCE_OR_NULL(dest) \
|
||||
Z_PARAM_RESOURCE_EX(dest, 1, 0)
|
||||
|
||||
/* old "s" */
|
||||
#define Z_PARAM_STRING_EX2(dest, dest_len, check_null, deref, separate) \
|
||||
Z_PARAM_PROLOGUE(deref, separate); \
|
||||
|
|
|
@ -534,7 +534,7 @@ PHP_FUNCTION(file_get_contents)
|
|||
Z_PARAM_PATH(filename, filename_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(use_include_path)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
Z_PARAM_LONG(offset)
|
||||
Z_PARAM_LONG(maxlen)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
@ -593,7 +593,7 @@ PHP_FUNCTION(file_put_contents)
|
|||
Z_PARAM_ZVAL(data)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(flags)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (Z_TYPE_P(data) == IS_RESOURCE) {
|
||||
|
@ -738,7 +738,7 @@ PHP_FUNCTION(file)
|
|||
Z_PARAM_PATH(filename, filename_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(flags)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
|
||||
|
@ -879,7 +879,7 @@ PHP_FUNCTION(fopen)
|
|||
Z_PARAM_STRING(mode, mode_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(use_include_path)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
@ -1296,7 +1296,7 @@ PHP_FUNCTION(mkdir)
|
|||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(mode)
|
||||
Z_PARAM_BOOL(recursive)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
@ -1317,7 +1317,7 @@ PHP_FUNCTION(rmdir)
|
|||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_PATH(dir, dir_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
@ -1342,7 +1342,7 @@ PHP_FUNCTION(readfile)
|
|||
Z_PARAM_PATH(filename, filename_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(use_include_path)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
@ -1419,7 +1419,7 @@ PHP_FUNCTION(rename)
|
|||
Z_PARAM_PATH(old_name, old_name_len)
|
||||
Z_PARAM_PATH(new_name, new_name_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0);
|
||||
|
@ -1458,7 +1458,7 @@ PHP_FUNCTION(unlink)
|
|||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_PATH(filename, filename_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
@ -1603,7 +1603,7 @@ PHP_FUNCTION(copy)
|
|||
Z_PARAM_PATH(source, source_len)
|
||||
Z_PARAM_PATH(target, target_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (php_check_open_basedir(source)) {
|
||||
|
|
|
@ -672,7 +672,7 @@ PHP_FUNCTION(get_headers)
|
|||
Z_PARAM_PATH(url, url_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(format)
|
||||
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
|
||||
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
context = php_stream_context_from_zval(zcontext, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue