Skip to content
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

[BUG] phalcon_fetch_params() restores too many stack frames #918

Merged
merged 1 commit into from Jul 25, 2013
Merged
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
6 changes: 3 additions & 3 deletions ext/kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,20 +322,20 @@ void phalcon_inherit_not_found(const char *class_name, const char *inherit_name)
/**
* Parses method parameters with minimum overhead
*/
int phalcon_fetch_parameters(int grow_stack, int num_args TSRMLS_DC, int required_args, int optional_args, ...)
int phalcon_fetch_parameters(int num_args TSRMLS_DC, int required_args, int optional_args, ...)
{
va_list va;
int arg_count = (int) (zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1);
zval **arg, **p;
int i;

if (num_args < required_args || (num_args > (required_args + optional_args))) {
phalcon_throw_exception_string(spl_ce_BadMethodCallException, SL("Wrong number of parameters"), grow_stack TSRMLS_CC);
phalcon_throw_exception_string(spl_ce_BadMethodCallException, SL("Wrong number of parameters"), 0 TSRMLS_CC);
return FAILURE;
}

if (num_args > arg_count) {
phalcon_throw_exception_string(spl_ce_BadMethodCallException, SL("Could not obtain parameters for parsing"), grow_stack TSRMLS_CC);
phalcon_throw_exception_string(spl_ce_BadMethodCallException, SL("Could not obtain parameters for parsing"), 0 TSRMLS_CC);
return FAILURE;
}

Expand Down
4 changes: 2 additions & 2 deletions ext/kernel/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern void phalcon_inherit_not_found(const char *class_name, const char *inheri
extern int phalcon_is_iterable_ex(zval *arr, HashTable **arr_hash, HashPosition *hash_position, int duplicate, int reverse);

/* Fetch Parameters */
extern int phalcon_fetch_parameters(int grow_stack, int num_args TSRMLS_DC, int required_args, int optional_args, ...);
extern int phalcon_fetch_parameters(int num_args TSRMLS_DC, int required_args, int optional_args, ...);

/* Compatibility with PHP 5.3 */
#ifndef ZVAL_COPY_VALUE
Expand Down Expand Up @@ -316,7 +316,7 @@ extern int phalcon_fetch_parameters(int grow_stack, int num_args TSRMLS_DC, int

/** Low overhead parse/fetch parameters */
#define phalcon_fetch_params(memory_grow, required_params, optional_params, ...) \
if (phalcon_fetch_parameters(memory_grow, ZEND_NUM_ARGS() TSRMLS_CC, required_params, optional_params, __VA_ARGS__) == FAILURE) { \
if (phalcon_fetch_parameters(ZEND_NUM_ARGS() TSRMLS_CC, required_params, optional_params, __VA_ARGS__) == FAILURE) { \
if (memory_grow) { \
RETURN_MM_NULL(); \
} else { \
Expand Down