Skip to content

Use ZEND_PARSE_PARAMETERS_NONE() macro #3116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,7 @@ ZEND_FUNCTION(get_called_class)
{
zend_class_entry *called_scope;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

called_scope = zend_get_called_scope(execute_data);
if (called_scope) {
Expand Down Expand Up @@ -1544,9 +1542,7 @@ ZEND_FUNCTION(get_included_files)
{
zend_string *entry;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) {
Expand Down Expand Up @@ -1628,9 +1624,7 @@ ZEND_FUNCTION(set_error_handler)
Restores the previously defined error handler function */
ZEND_FUNCTION(restore_error_handler)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval zeh;
Expand Down Expand Up @@ -1693,9 +1687,7 @@ ZEND_FUNCTION(set_exception_handler)
Restores the previously defined exception handler function */
ZEND_FUNCTION(restore_exception_handler)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_exception_handler));
Expand Down Expand Up @@ -1739,9 +1731,7 @@ ZEND_FUNCTION(get_declared_traits)
uint32_t mask = ZEND_ACC_TRAIT;
uint32_t comply = 1;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
Expand All @@ -1755,9 +1745,7 @@ ZEND_FUNCTION(get_declared_classes)
uint32_t mask = ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT;
uint32_t comply = 0;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
Expand All @@ -1771,9 +1759,7 @@ ZEND_FUNCTION(get_declared_interfaces)
uint32_t mask = ZEND_ACC_INTERFACE;
uint32_t comply = 1;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

array_init(return_value);
zend_hash_apply_with_arguments(EG(class_table), copy_class_or_interface_name, 3, return_value, mask, comply);
Expand Down
23 changes: 9 additions & 14 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ ZEND_METHOD(error_exception, __construct)
}
/* }}} */

#define DEFAULT_0_PARAMS \
if (zend_parse_parameters_none() == FAILURE) { \
return; \
}

#define GET_PROPERTY(object, id) \
zend_read_property_ex(i_get_exception_base(object), (object), ZSTR_KNOWN(id), 0, &rv)
#define GET_PROPERTY_SILENT(object, id) \
Expand All @@ -402,7 +397,7 @@ ZEND_METHOD(exception, getFile)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_FILE));
}
Expand All @@ -414,7 +409,7 @@ ZEND_METHOD(exception, getLine)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_LINE));
}
Expand All @@ -426,7 +421,7 @@ ZEND_METHOD(exception, getMessage)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_MESSAGE));
}
Expand All @@ -438,7 +433,7 @@ ZEND_METHOD(exception, getCode)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_CODE));
}
Expand All @@ -450,7 +445,7 @@ ZEND_METHOD(exception, getTrace)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_TRACE));
}
Expand All @@ -462,7 +457,7 @@ ZEND_METHOD(error_exception, getSeverity)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY(getThis(), ZEND_STR_SEVERITY));
}
Expand Down Expand Up @@ -608,7 +603,7 @@ ZEND_METHOD(exception, getTraceAsString)
smart_str str = {0};
uint32_t num = 0;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

object = getThis();
base_ce = i_get_exception_base(object);
Expand Down Expand Up @@ -641,7 +636,7 @@ ZEND_METHOD(exception, getPrevious)
{
zval rv;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

ZVAL_COPY(return_value, GET_PROPERTY_SILENT(getThis(), ZEND_STR_PREVIOUS));
} /* }}} */
Expand All @@ -657,7 +652,7 @@ ZEND_METHOD(exception, __toString)
zval rv, tmp;
zend_string *fname;

DEFAULT_0_PARAMS;
ZEND_PARSE_PARAMETERS_NONE();

str = ZSTR_EMPTY_ALLOC();

Expand Down
28 changes: 7 additions & 21 deletions Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,7 @@ ZEND_METHOD(Generator, rewind)
{
zend_generator *generator;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand All @@ -853,9 +851,7 @@ ZEND_METHOD(Generator, valid)
{
zend_generator *generator;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand All @@ -873,9 +869,7 @@ ZEND_METHOD(Generator, current)
{
zend_generator *generator, *root;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand All @@ -897,9 +891,7 @@ ZEND_METHOD(Generator, key)
{
zend_generator *generator, *root;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand All @@ -921,9 +913,7 @@ ZEND_METHOD(Generator, next)
{
zend_generator *generator;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand Down Expand Up @@ -1016,9 +1006,7 @@ ZEND_METHOD(Generator, getReturn)
{
zend_generator *generator;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

generator = (zend_generator *) Z_OBJ_P(getThis());

Expand Down Expand Up @@ -1046,9 +1034,7 @@ ZEND_METHOD(Generator, __wakeup)
* because it is only invoked for C unserialization. For O the error has
* to be thrown in __wakeup. */

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

zend_throw_exception(NULL, "Unserialization of 'Generator' is not allowed", 0);
}
Expand Down
4 changes: 1 addition & 3 deletions ext/com_dotnet/com_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,7 @@ PHP_FUNCTION(com_create_guid)
GUID retval;
OLECHAR *guid_string;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

php_com_initialize();
if (CoCreateGuid(&retval) == S_OK && StringFromCLSID(&retval, &guid_string) == S_OK) {
Expand Down
5 changes: 2 additions & 3 deletions ext/curl/curl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ static void curlfile_get_property(char *name, size_t name_len, INTERNAL_FUNCTION
{
zval *res, rv;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

res = zend_read_property(curl_CURLFile_class, getThis(), name, name_len, 1, &rv);
ZVAL_DEREF(res);
ZVAL_COPY(return_value, res);
Expand Down
4 changes: 1 addition & 3 deletions ext/curl/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ PHP_FUNCTION(curl_multi_init)
{
php_curlm *mh;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
Expand Down
4 changes: 1 addition & 3 deletions ext/curl/share.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ PHP_FUNCTION(curl_share_init)
{
php_curlsh *sh;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

sh = ecalloc(1, sizeof(php_curlsh));

Expand Down
25 changes: 7 additions & 18 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,7 @@ static zend_object_handlers date_object_handlers_period;
php_date_obj *obj; \
DATE_SET_CONTEXT; \
if (object) { \
if (zend_parse_parameters_none() == FAILURE) { \
return; \
} \
ZEND_PARSE_PARAMETERS_NONE(); \
} else { \
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "O", &object, date_ce_date) == FAILURE) { \
RETURN_FALSE; \
Expand Down Expand Up @@ -1764,9 +1762,7 @@ PHP_FUNCTION(gmstrftime)
Return current UNIX timestamp */
PHP_FUNCTION(time)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

RETURN_LONG((zend_long)time(NULL));
}
Expand Down Expand Up @@ -4661,9 +4657,7 @@ PHP_METHOD(DatePeriod, getStartDate)
php_period_obj *dpobj;
php_date_obj *dateobj;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

dpobj = Z_PHPPERIOD_P(getThis());

Expand All @@ -4688,9 +4682,7 @@ PHP_METHOD(DatePeriod, getEndDate)
php_period_obj *dpobj;
php_date_obj *dateobj;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

dpobj = Z_PHPPERIOD_P(getThis());

Expand Down Expand Up @@ -4719,9 +4711,7 @@ PHP_METHOD(DatePeriod, getDateInterval)
php_period_obj *dpobj;
php_interval_obj *diobj;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

dpobj = Z_PHPPERIOD_P(getThis());

Expand Down Expand Up @@ -4865,9 +4855,8 @@ PHP_FUNCTION(date_default_timezone_set)
PHP_FUNCTION(date_default_timezone_get)
{
timelib_tzinfo *default_tz;
if (zend_parse_parameters_none() == FAILURE) {
return;
}

ZEND_PARSE_PARAMETERS_NONE();

default_tz = get_timezone_info();
RETVAL_STRING(default_tz->name);
Expand Down
4 changes: 1 addition & 3 deletions ext/dom/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -1893,9 +1893,7 @@ PHP_METHOD(domnode, getLineNo)
xmlNode *nodep;
dom_object *intern;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);

Expand Down
5 changes: 0 additions & 5 deletions ext/dom/php_dom.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ entry = zend_register_internal_class_ex(&ce, parent_ce);
} \
}

#define DOM_NO_ARGS() \
if (zend_parse_parameters_none() == FAILURE) { \
return; \
}

#define DOM_NOT_IMPLEMENTED() \
php_error_docref(NULL, E_WARNING, "Not yet implemented"); \
return;
Expand Down
4 changes: 1 addition & 3 deletions ext/enchant/enchant.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ PHP_FUNCTION(enchant_broker_init)
enchant_broker *broker;
EnchantBroker *pbroker;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
ZEND_PARSE_PARAMETERS_NONE();

pbroker = enchant_broker_init();

Expand Down
Loading