Skip to content

Commit

Permalink
MFH: Added new macro for check void parameters.
Browse files Browse the repository at this point in the history
(deprecating ZEND_WRONG_PARAM_COUNT for this cases)
  • Loading branch information
felipensp committed Mar 10, 2008
1 parent 725b31f commit cc2b17d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Zend/zend_API.h
Expand Up @@ -189,7 +189,8 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS
_zend_get_parameters_array(ht, param_count, argument_array TSRMLS_CC)
#define zend_get_parameters_array_ex(param_count, argument_array) \
_zend_get_parameters_array_ex(param_count, argument_array TSRMLS_CC)

#define zend_parse_parameters_none() \
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")

/* Parameter parsing API -- andrei */

Expand Down
20 changes: 10 additions & 10 deletions Zend/zend_builtin_functions.c
Expand Up @@ -1182,8 +1182,8 @@ ZEND_FUNCTION(crash)
ZEND_FUNCTION(get_included_files)
{
char *entry;
if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}

array_init(return_value);
Expand Down Expand Up @@ -1394,8 +1394,8 @@ ZEND_FUNCTION(get_declared_classes)
zend_uint mask = ZEND_ACC_INTERFACE;
zend_uint comply = 0;

if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}

array_init(return_value);
Expand All @@ -1410,8 +1410,8 @@ ZEND_FUNCTION(get_declared_interfaces)
zend_uint mask = ZEND_ACC_INTERFACE;
zend_uint comply = 1;

if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}

array_init(return_value);
Expand Down Expand Up @@ -1446,8 +1446,8 @@ ZEND_FUNCTION(get_defined_functions)
zval *internal;
zval *user;

if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}

MAKE_STD_ZVAL(internal);
Expand Down Expand Up @@ -1763,8 +1763,8 @@ ZEND_FUNCTION(debug_print_backtrace)
zval *arg_array = NULL;
int indent = 0;

if (ZEND_NUM_ARGS()) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}

ptr = EG(current_execute_data);
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_exceptions.c
Expand Up @@ -182,8 +182,8 @@ ZEND_METHOD(error_exception, __construct)
/* }}} */

#define DEFAULT_0_PARAMS \
if (ZEND_NUM_ARGS() > 0) { \
ZEND_WRONG_PARAM_COUNT(); \
if (zend_parse_parameters_none() == FAILURE) { \
return; \
}

static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */
Expand Down

0 comments on commit cc2b17d

Please sign in to comment.