/* uncomment this if/when we actually need it - tired of seeing the warning
static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
*/
-static pval *user_compare_func_name;
+static pval **user_compare_func_name;
static HashTable *user_shutdown_function_names;
typedef struct _php_shutdown_function_entry {
#if FHTTPD
int i;
#endif
- pval *str;
+ pval **str;
char *ptr;
#if APACHE
SLS_FETCH();
#endif
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(str);
+ convert_to_string_ex(str);
#if FHTTPD
ptr=NULL;
- if (str->type == IS_STRING && req){
+ if ((*str)->type == IS_STRING && req){
for(i=0;i<req->nlines;i++){
if (req->lines[i].paramc>1){
if (req->lines[i].params[0]){
if (!strcmp(req->lines[i].params[0],
- str->value.str.val)){
+ (*str)->value.str.val)){
ptr=req->lines[i].params[1];
i=req->nlines;
}
}
}
}
- if (!ptr) ptr = getenv(str->value.str.val);
+ if (!ptr) ptr = getenv((*str)->value.str.val);
if (ptr
#else
- if (str->type == IS_STRING &&
+ if ((*str)->type == IS_STRING &&
#if APACHE
- ((ptr = (char *)table_get(((request_rec *) SG(server_context))->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val)))
+ ((ptr = (char *)table_get(((request_rec *) SG(server_context))->subprocess_env, (*str)->value.str.val)) || (ptr = getenv((*str)->value.str.val)))
#endif
#if CGI_BINARY
- (ptr = getenv(str->value.str.val))
+ (ptr = getenv((*str)->value.str.val))
#endif
#if USE_SAPI
- (ptr = sapi_rqst->getenv(sapi_rqst->scid,str->value.str.val))
+ (ptr = sapi_rqst->getenv(sapi_rqst->scid,(*str)->value.str.val))
#endif
#endif
) {
#ifdef HAVE_PUTENV
PHP_FUNCTION(putenv)
{
+ pval **str;
- pval *str;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(str);
+ convert_to_string_ex(str);
- if (str->value.str.val && *(str->value.str.val)) {
+ if ((*str)->value.str.val && *((*str)->value.str.val)) {
int ret;
char *p,**env;
putenv_entry pe;
- pe.putenv_string = estrndup(str->value.str.val,str->value.str.len);
- pe.key = str->value.str.val;
+ pe.putenv_string = estrndup((*str)->value.str.val,(*str)->value.str.len);
+ pe.key = (*str)->value.str.val;
if ((p=strchr(pe.key,'='))) { /* nullify the '=' if there is one */
*p='\0';
}
{
/* has to be implemented within Zend */
#if 0
- pval *value;
+ pval **value;
int ret;
ret = php3_ini.short_open_tag;
- if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&value) == FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1,&value) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(value);
- php3_ini.short_open_tag = value->value.lval;
+ convert_to_long_ex(value);
+ php3_ini.short_open_tag = (*value)->value.lval;
RETURN_LONG(ret);
#endif
}
PHP_FUNCTION(intval)
{
- pval *num, *arg_base;
+ pval **num, **arg_base;
int base;
switch(ARG_COUNT(ht)) {
case 1:
- if (getParameters(ht, 1, &num) == FAILURE) {
+ if (getParametersEx(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
base = 10;
break;
case 2:
- if (getParameters(ht, 2, &num, &arg_base) == FAILURE) {
+ if (getParametersEx(2, &num, &arg_base) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(arg_base);
- base = arg_base->value.lval;
+ convert_to_long_ex(arg_base);
+ base = (*arg_base)->value.lval;
break;
default:
WRONG_PARAM_COUNT;
}
-
- convert_to_long_base(num, base);
- *return_value = *num;
+ *return_value=**num;
+ zval_copy_ctor(return_value);
+ convert_to_long_base(return_value,base);
}
PHP_FUNCTION(doubleval)
{
- pval *num;
+ pval **num;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_double(num);
- *return_value = *num;
+ *return_value=**num;
+ zval_copy_ctor(return_value);
+ convert_to_double(return_value);
}
-
+
PHP_FUNCTION(strval)
{
- pval *num;
+ pval **num;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(num);
- *return_value = *num;
- pval_copy_constructor(return_value);
+ *return_value=**num;
+ zval_copy_ctor(return_value);
+ convert_to_string(return_value);
}
static int array_key_compare(const void *a, const void *b)
PHP_FUNCTION(krsort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in krsort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to krsort()");
- return;
- }
if (zend_hash_sort(target_hash, array_reverse_key_compare,0) == FAILURE) {
return;
}
PHP_FUNCTION(ksort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in ksort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to ksort()");
- return;
- }
if (zend_hash_sort(target_hash, array_key_compare,0) == FAILURE) {
return;
}
if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
-
target_hash = HASH_OF(*array);
if (!target_hash) {
if ((*array)->type == IS_STRING && (*array)->value.str.val==undefined_variable_string) {
PHP_FUNCTION(asort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in asort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to asort()");
- return;
- }
if (zend_hash_sort(target_hash, array_data_compare,0) == FAILURE) {
return;
}
PHP_FUNCTION(arsort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in arsort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to arsort()");
- return;
- }
if (zend_hash_sort(target_hash, array_reverse_data_compare,0) == FAILURE) {
return;
}
PHP_FUNCTION(sort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in sort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to sort()");
- return;
- }
if (zend_hash_sort(target_hash, array_data_compare,1) == FAILURE) {
return;
}
PHP_FUNCTION(rsort)
{
- pval *array;
+ pval **array;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in rsort() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to rsort()");
- return;
- }
if (zend_hash_sort(target_hash, array_reverse_data_compare,1) == FAILURE) {
return;
}
args[0] = (pval **) f->pData;
args[1] = (pval **) s->pData;
- if (call_user_function_ex(CG(function_table), NULL, user_compare_func_name, &retval, 2, args, 0)==SUCCESS) {
+ if (call_user_function_ex(CG(function_table), NULL, *user_compare_func_name, &retval, 2, args, 0)==SUCCESS) {
convert_to_long(&retval);
return retval.value.lval;
} else {
PHP_FUNCTION(usort)
{
- pval *array;
- pval *old_compare_func;
+ pval **array;
+ pval **old_compare_func;
HashTable *target_hash;
old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2, &array, &user_compare_func_name) == FAILURE) {
user_compare_func_name = old_compare_func;
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in usort() call");
user_compare_func_name = old_compare_func;
return;
}
- convert_to_string(user_compare_func_name);
+ convert_to_string_ex(user_compare_func_name);
if (zend_hash_sort(target_hash, array_user_compare, 1) == FAILURE) {
user_compare_func_name = old_compare_func;
return;
PHP_FUNCTION(uasort)
{
- pval *array;
- pval *old_compare_func;
+ pval **array;
+ pval **old_compare_func;
HashTable *target_hash;
old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2, &array, &user_compare_func_name) == FAILURE) {
user_compare_func_name = old_compare_func;
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in uasort() call");
user_compare_func_name = old_compare_func;
return;
}
- convert_to_string(user_compare_func_name);
+ convert_to_string_ex(user_compare_func_name);
if (zend_hash_sort(target_hash, array_user_compare, 0) == FAILURE) {
user_compare_func_name = old_compare_func;
return;
key2.type = IS_LONG;
}
- status = call_user_function(CG(function_table), NULL, user_compare_func_name, &retval, 2, args);
+ status = call_user_function(CG(function_table), NULL, *user_compare_func_name, &retval, 2, args);
pval_destructor(&key1);
pval_destructor(&key2);
PHP_FUNCTION(uksort)
{
- pval *array;
- pval *old_compare_func;
+ pval **array;
+ pval **old_compare_func;
HashTable *target_hash;
old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2, &array, &user_compare_func_name) == FAILURE) {
user_compare_func_name = old_compare_func;
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in uksort() call");
user_compare_func_name = old_compare_func;
return;
}
- convert_to_string(user_compare_func_name);
+ convert_to_string_ex(user_compare_func_name);
if (zend_hash_sort(target_hash, array_user_key_compare, 0) == FAILURE) {
user_compare_func_name = old_compare_func;
return;
RETURN_TRUE;
}
-
PHP_FUNCTION(end)
{
- pval *array, **entry;
+ pval **array, **entry;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to end() is not an array or object");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to end()");
- }
zend_hash_internal_pointer_end(target_hash);
if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
RETURN_FALSE;
PHP_FUNCTION(prev)
{
- pval *array, **entry;
+ pval **array, **entry;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to prev() is not an array or object");
RETURN_FALSE;
PHP_FUNCTION(next)
{
- pval *array, **entry;
+ pval **array, **entry;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to next() is not an array or object");
RETURN_FALSE;
PHP_FUNCTION(reset)
{
- pval *array, **entry;
+ pval **array, **entry;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to reset() is not an array or object");
return;
*return_value = **entry;
pval_copy_constructor(return_value);
- INIT_PZVAL(return_value);
+ INIT_PZVAL(return_value); /* XXX is this needed? */
}
PHP_FUNCTION(current)
{
- pval *array, **entry;
+ pval **array, **entry;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to current() is not an array or object");
return;
PHP_FUNCTION(key)
{
- pval *array;
+ pval **array;
char *string_key;
ulong num_key;
HashTable *target_hash;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Variable passed to key() is not an array or object");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to key()");
- }
switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) {
case HASH_KEY_IS_STRING:
return_value->value.str.val = string_key;
PHP_FUNCTION(sleep)
{
- pval *num;
+ pval **num;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(num);
- sleep(num->value.lval);
+ convert_to_long_ex(num);
+ sleep((*num)->value.lval);
}
PHP_FUNCTION(usleep)
{
#if HAVE_USLEEP
- pval *num;
+ pval **num;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(num);
- usleep(num->value.lval);
+ convert_to_long_ex(num);
+ usleep((*num)->value.lval);
#endif
}
PHP_FUNCTION(gettype)
{
- pval *arg;
+ pval **arg;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
- switch (arg->type) {
+ switch ((*arg)->type) {
case IS_BOOL:
RETVAL_STRING("boolean",1);
break;
PHP_FUNCTION(settype)
{
- pval *var, *type;
+ pval **var, **type;
char *new_type;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &var, &type) ==
- FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2, &var, &type) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(type);
- new_type = type->value.str.val;
+ convert_to_string_ex(type);
+ new_type = (*type)->value.str.val;
if (!strcasecmp(new_type, "integer")) {
- convert_to_long(var);
+ convert_to_long(*var);
} else if (!strcasecmp(new_type, "double")) {
- convert_to_double(var);
+ convert_to_double(*var);
} else if (!strcasecmp(new_type, "string")) {
- convert_to_string(var);
+ convert_to_string(*var);
} else if (!strcasecmp(new_type, "array")) {
- convert_to_array(var);
+ convert_to_array(*var);
} else if (!strcasecmp(new_type, "object")) {
- convert_to_object(var);
+ convert_to_object(*var);
} else if (!strcasecmp(new_type, "boolean")) {
- convert_to_boolean(var);
+ convert_to_boolean(*var);
} else if (!strcasecmp(new_type, "resource")) {
php_error(E_WARNING, "settype: cannot convert to resource type");
RETURN_FALSE;
return;
}
if (argc == 1) {
- pval *arr;
+ pval **arr;
- if (getParameters(ht, 1, &arr) == FAILURE ||
- arr->type != IS_ARRAY) {
+ if (getParametersEx(1, &arr) == FAILURE || (*arr)->type != IS_ARRAY) {
WRONG_PARAM_COUNT;
}
- if (zend_hash_minmax(arr->value.ht, array_data_compare, 0, (void **) &result)==SUCCESS) {
+ if (zend_hash_minmax((*arr)->value.ht, array_data_compare, 0, (void **) &result)==SUCCESS) {
*return_value = **result;
pval_copy_constructor(return_value);
} else {
php_error(E_WARNING, "min: array must contain at least 1 element");
- var_uninit(return_value);
+ RETURN_FALSE;
}
} else {
- pval **args = (pval **) emalloc(sizeof(pval *)*ARG_COUNT(ht));
- pval *min, result;
+ pval ***args = (pval ***) emalloc(sizeof(pval **)*ARG_COUNT(ht));
+ pval **min, result;
int i;
- if (getParametersArray(ht, ARG_COUNT(ht), args)==FAILURE) {
+ if (getParametersArrayEx(ARG_COUNT(ht), args)==FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
min = args[0];
for (i=1; i<ARG_COUNT(ht); i++) {
- is_smaller_function(&result, args[i], min);
+ is_smaller_function(&result, *args[i], *min);
if (result.value.lval == 1) {
min = args[i];
}
}
- *return_value = *min;
+ *return_value = **min;
pval_copy_constructor(return_value);
efree(args);
return;
}
if (argc == 1) {
- pval *arr;
+ pval **arr;
- if (getParameters(ht, 1, &arr) == FAILURE ||
- arr->type != IS_ARRAY) {
+ if (getParametersEx(1, &arr) == FAILURE || (*arr)->type != IS_ARRAY) {
WRONG_PARAM_COUNT;
}
- if (zend_hash_minmax(arr->value.ht, array_data_compare, 1, (void **) &result)==SUCCESS) {
+ if (zend_hash_minmax((*arr)->value.ht, array_data_compare, 1, (void **) &result)==SUCCESS) {
*return_value = **result;
pval_copy_constructor(return_value);
} else {
php_error(E_WARNING, "max: array must contain at least 1 element");
- var_uninit(return_value);
+ RETURN_FALSE;
}
} else {
- pval **args = (pval **) emalloc(sizeof(pval *)*ARG_COUNT(ht));
- pval *max, result;
+ pval ***args = (pval ***) emalloc(sizeof(pval **)*ARG_COUNT(ht));
+ pval **max, result;
int i;
- if (getParametersArray(ht, ARG_COUNT(ht), args)==FAILURE) {
+ if (getParametersArrayEx(ARG_COUNT(ht), args)==FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
max = args[0];
for (i=1; i<ARG_COUNT(ht); i++) {
- is_smaller_or_equal_function(&result, args[i], max);
+ is_smaller_or_equal_function(&result, *args[i], *max);
if (result.value.lval == 0) {
max = args[i];
}
}
- *return_value = *max;
+ *return_value = **max;
pval_copy_constructor(return_value);
efree(args);
RETURN_TRUE;
}
-#if 0
-PHP_FUNCTION(max)
-{
- pval **argv;
- int argc, i;
- unsigned short max_type = IS_LONG;
-
- argc = ARG_COUNT(ht);
- /* if there is one parameter and this parameter is an array of
- * 2 or more elements, use that array
- */
- if (argc == 1) {
- argv = (pval **)emalloc(sizeof(pval *) * argc);
- if (getParametersArray(ht, argc, argv) == FAILURE ||
- argv[0]->type != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (argv[0]->value.ht->nNumOfElements < 2) {
- php_error(E_WARNING,
- "min: array must contain at least 2 elements");
- RETURN_FALSE;
- }
- /* replace the function parameters with the array */
- ht = argv[0]->value.ht;
- argc = zend_hash_num_elements(ht);
- efree(argv);
- } else if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- argv = (pval **)emalloc(sizeof(pval *) * argc);
- if (getParametersArray(ht, argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
- /* figure out what types to compare
- * if the arguments contain a double, convert all of them to a double
- * else convert all of them to long
- */
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == IS_DOUBLE) {
- max_type = IS_DOUBLE;
- break;
- }
- }
- if (max_type == IS_LONG) {
- convert_to_long(argv[0]);
- return_value->value.lval = argv[0]->value.lval;
- for (i = 1; i < argc; i++) {
- convert_to_long(argv[i]);
- if (argv[i]->value.lval > return_value->value.lval) {
- return_value->value.lval = argv[i]->value.lval;
- }
- }
- } else {
- convert_to_double(argv[0]);
- return_value->value.dval = argv[0]->value.dval;
- for (i = 1; i < argc; i++) {
- convert_to_double(argv[i]);
- if (argv[i]->value.dval > return_value->value.dval) {
- return_value->value.dval = argv[i]->value.dval;
- }
- }
- }
- efree(argv);
- return_value->type = max_type;
-}
-#endif
PHP_FUNCTION(get_current_user)
{
PHP_FUNCTION(get_cfg_var)
{
- pval *varname;
+ pval **varname;
char *value;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &varname)==FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(varname);
+ convert_to_string_ex(varname);
- if (cfg_get_string(varname->value.str.val,&value)==FAILURE) {
+ if (cfg_get_string((*varname)->value.str.val,&value)==FAILURE) {
RETURN_FALSE;
}
RETURN_STRING(value,1);
PHP_FUNCTION(set_magic_quotes_runtime)
{
- pval *new_setting;
+ pval **new_setting;
PLS_FETCH();
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_setting)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &new_setting)==FAILURE) {
RETURN_FALSE;
}
- convert_to_boolean(new_setting);
+ convert_to_boolean_ex(new_setting);
- PG(magic_quotes_runtime) = (zend_bool) new_setting->value.lval;
+ PG(magic_quotes_runtime) = (zend_bool) (*new_setting)->value.lval;
RETURN_TRUE;
}
PHP_FUNCTION(error_log)
{
- pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL;
+ pval **string, **erropt = NULL, **option = NULL, **emailhead = NULL;
int opt_err = 0;
char *message, *opt=NULL, *headers=NULL;
switch(ARG_COUNT(ht)) {
case 1:
- if (getParameters(ht,1,&string) == FAILURE) {
+ if (getParametersEx(1,&string) == FAILURE) {
php_error(E_WARNING,"Invalid argument 1 in error_log");
RETURN_FALSE;
}
break;
case 2:
- if (getParameters(ht,2,&string,&erropt) == FAILURE) {
+ if (getParametersEx(2,&string,&erropt) == FAILURE) {
php_error(E_WARNING,"Invalid arguments in error_log");
RETURN_FALSE;
}
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
+ convert_to_long_ex(erropt);
+ opt_err=(*erropt)->value.lval;
break;
case 3:
- if (getParameters(ht,3,&string,&erropt,&option) == FAILURE){
+ if (getParametersEx(3,&string,&erropt,&option) == FAILURE){
php_error(E_WARNING,"Invalid arguments in error_log");
RETURN_FALSE;
}
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
- convert_to_string(option);
- opt=option->value.str.val;
+ convert_to_long_ex(erropt);
+ opt_err=(*erropt)->value.lval;
+ convert_to_string_ex(option);
+ opt=(*option)->value.str.val;
break;
case 4:
- if (getParameters(ht,4,&string,&erropt,&option,&emailhead) == FAILURE){
+ if (getParametersEx(4,&string,&erropt,&option,&emailhead) == FAILURE){
php_error(E_WARNING,"Invalid arguments in error_log");
RETURN_FALSE;
}
WRONG_PARAM_COUNT;
}
- convert_to_string(string);
- message=string->value.str.val;
+ convert_to_string_ex(string);
+ message=(*string)->value.str.val;
if (erropt != NULL) {
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
+ convert_to_long_ex(erropt);
+ opt_err=(*erropt)->value.lval;
}
if (option != NULL) {
- convert_to_string(option);
- opt=option->value.str.val;
+ convert_to_string_ex(option);
+ opt=(*option)->value.str.val;
}
if (emailhead != NULL) {
- convert_to_string(emailhead);
- headers=emailhead->value.str.val;
+ convert_to_string_ex(emailhead);
+ headers=(*emailhead)->value.str.val;
}
if (_php_error_log(opt_err,message,opt,headers)==FAILURE) {
Syntax highlight a source file */
PHP_FUNCTION(highlight_file)
{
- pval *filename;
+ pval **filename;
zend_syntax_highlighter_ini syntax_highlighter_ini;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &filename)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &filename)==FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(filename);
+ convert_to_string_ex(filename);
php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_file(filename->value.str.val, &syntax_highlighter_ini)==FAILURE) {
+ if (highlight_file((*filename)->value.str.val, &syntax_highlighter_ini)==FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
Syntax highlight a string */
PHP_FUNCTION(highlight_string)
{
- pval *expr;
+ pval **expr;
zend_syntax_highlighter_ini syntax_highlighter_ini;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &expr)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &expr)==FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(expr);
+ convert_to_string_ex(expr);
php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_string(expr, &syntax_highlighter_ini)==FAILURE) {
+ if (highlight_string(*expr, &syntax_highlighter_ini)==FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
PHP_FUNCTION(ini_get)
{
- pval *varname;
+ pval **varname;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &varname)==FAILURE) {
WRONG_PARAM_COUNT;
}
- return_value->value.str.val = php_ini_string(varname->value.str.val, varname->value.str.len+1, 0);
+ convert_to_string_ex(varname);
+
+ return_value->value.str.val = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0);
if (!return_value->value.str.val) {
RETURN_FALSE;
PHP_FUNCTION(ini_alter)
{
- pval *varname, *new_value;
+ pval **varname, **new_value;
char *old_value;
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &varname, &new_value)==FAILURE) {
+ if (ARG_COUNT(ht)!=2 || getParametersEx(2, &varname, &new_value)==FAILURE) {
WRONG_PARAM_COUNT;
}
- old_value = php_ini_string(varname->value.str.val, varname->value.str.len+1, 0);
-
+ convert_to_string_ex(varname);
+ convert_to_string_ex(new_value);
- convert_to_string(new_value);
+ old_value = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0);
- if (php_alter_ini_entry(varname->value.str.val, varname->value.str.len+1, new_value->value.str.val, new_value->value.str.len, PHP_INI_USER)==FAILURE) {
+ if (php_alter_ini_entry((*varname)->value.str.val, (*varname)->value.str.len+1, (*new_value)->value.str.val, (*new_value)->value.str.len, PHP_INI_USER)==FAILURE) {
RETURN_FALSE;
}
if (old_value) {
PHP_FUNCTION(ini_restore)
{
- pval *varname;
+ pval **varname;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &varname)==FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(varname);
+ convert_to_string_ex(varname);
- php_restore_ini_entry(varname->value.str.val, varname->value.str.len);
+ php_restore_ini_entry((*varname)->value.str.val, (*varname)->value.str.len);
}
PHP_FUNCTION(print_r)
{
- pval *expr;
+ pval **expr;
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &expr)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &expr)==FAILURE) {
WRONG_PARAM_COUNT;
}
- zend_print_pval_r(expr, 0);
+ zend_print_pval_r(*expr, 0);
+
RETURN_TRUE;
}
Set whether we want to ignore a user abort event or not */
PHP_FUNCTION(ignore_user_abort)
{
- pval *arg;
+ pval **arg;
int old_setting;
PLS_FETCH();
case 0:
break;
case 1:
- if (getParameters(ht,1,&arg) == FAILURE) {
+ if (getParametersEx(1, &arg) == FAILURE) {
RETURN_FALSE;
}
- convert_to_boolean(arg);
- PG(ignore_user_abort) = (zend_bool) arg->value.lval;
+ convert_to_boolean_ex(arg);
+ PG(ignore_user_abort) = (zend_bool) (*arg)->value.lval;
break;
default:
WRONG_PARAM_COUNT;
Checks if a given function has been defined */
PHP_FUNCTION(function_exists)
{
- pval *fname;
+ pval **fname;
pval *tmp;
char *lcname;
CLS_FETCH();
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &fname)==FAILURE) {
+ if (ARG_COUNT(ht)!=1 || getParametersEx(1, &fname)==FAILURE) {
WRONG_PARAM_COUNT;
}
-
- lcname = estrdup(fname->value.str.val);
- zend_str_tolower(lcname, fname->value.str.len);
+ convert_to_string_ex(fname);
+
+ lcname = estrdup((*fname)->value.str.val);
+ zend_str_tolower(lcname, (*fname)->value.str.len);
if (zend_hash_find(CG(function_table), lcname,
- fname->value.str.len+1, (void**)&tmp) == FAILURE) {
+ (*fname)->value.str.len+1, (void**)&tmp) == FAILURE) {
efree(lcname);
RETURN_FALSE;
} else {
Checks if the given value exists in the array */
PHP_FUNCTION(in_array)
{
- zval *value, /* value to check for */
- *array, /* array to check in */
+ zval **value, /* value to check for */
+ **array, /* array to check in */
**entry_ptr, /* pointer to array entry */
*entry, /* actual array entry */
res; /* comparison result */
HashTable *target_hash; /* array hashtable */
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &value, &array) == FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2, &value, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (value->type == IS_ARRAY || value->type == IS_OBJECT) {
+ if ((*value)->type == IS_ARRAY || (*value)->type == IS_OBJECT) {
zend_error(E_WARNING, "Wrong datatype for first argument in call to in_array()");
return;
}
- if (array->type != IS_ARRAY) {
+ if ((*array)->type != IS_ARRAY) {
zend_error(E_WARNING, "Wrong datatype for second argument in call to in_array()");
return;
}
- target_hash = HASH_OF(array);
+ target_hash = HASH_OF(*array);
zend_hash_internal_pointer_reset(target_hash);
while(zend_hash_get_current_data(target_hash, (void **)&entry_ptr) == SUCCESS) {
entry = *entry_ptr;
- is_equal_function(&res, value, entry);
+ is_equal_function(&res, *value, entry);
if (zval_is_true(&res)) {
RETURN_TRUE;
}
Imports variables into symbol table from an array */
PHP_FUNCTION(extract)
{
- zval *var_array, *etype, *prefix;
+ zval **var_array, **etype, **prefix;
zval **entry_ptr, *entry, *exist;
zval *data;
char *varname, *finalname;
switch(ARG_COUNT(ht)) {
case 1:
- if (getParameters(ht, 1, &var_array) == FAILURE) {
+ if (getParametersEx(1, &var_array) == FAILURE) {
WRONG_PARAM_COUNT;
}
extype = EXTR_OVERWRITE;
break;
case 2:
- if (getParameters(ht, 2, &var_array, &etype) == FAILURE) {
+ if (getParametersEx(2, &var_array, &etype) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(etype);
- extype = etype->value.lval;
+ convert_to_long_ex(etype);
+ extype = (*etype)->value.lval;
if (extype > EXTR_SKIP && extype <= EXTR_PREFIX_ALL) {
WRONG_PARAM_COUNT;
}
break;
case 3:
- if (getParameters(ht, 3, &var_array, &etype, &prefix) == FAILURE) {
+ if (getParametersEx(3, &var_array, &etype, &prefix) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(etype);
- extype = etype->value.lval;
+ convert_to_long_ex(etype);
+ extype = (*etype)->value.lval;
+ convert_to_string_ex(prefix);
break;
default:
return;
}
- if (var_array->type != IS_ARRAY) {
+ if ((*var_array)->type != IS_ARRAY) {
zend_error(E_WARNING, "Wrong datatype in call to extract()");
return;
}
- zend_hash_internal_pointer_reset(var_array->value.ht);
- while(zend_hash_get_current_data(var_array->value.ht, (void **)&entry_ptr) == SUCCESS) {
+ zend_hash_internal_pointer_reset((*var_array)->value.ht);
+ while(zend_hash_get_current_data((*var_array)->value.ht, (void **)&entry_ptr) == SUCCESS) {
entry = *entry_ptr;
- if (zend_hash_get_current_key(var_array->value.ht, &varname, &lkey) ==
- HASH_KEY_IS_STRING) {
+ if (zend_hash_get_current_key((*var_array)->value.ht, &varname, &lkey) == HASH_KEY_IS_STRING) {
if (_valid_var_name(varname)) {
finalname = NULL;
case EXTR_PREFIX_ALL:
if (!finalname) {
- finalname = emalloc(strlen(varname) + prefix->value.str.len + 2);
- strcpy(finalname, prefix->value.str.val);
+ finalname = emalloc(strlen(varname) + (*prefix)->value.str.len + 2);
+ strcpy(finalname, (*prefix)->value.str.val);
strcat(finalname, "_");
strcat(finalname, varname);
}
efree(varname);
}
- zend_hash_move_forward(var_array->value.ht);
+ zend_hash_move_forward((*var_array)->value.ht);
}
}
/* }}} */
Creates a hash containing variables and their values */
PHP_FUNCTION(compact)
{
- zval **args; /* function arguments array */
+ zval ***args; /* function arguments array */
int i;
ELS_FETCH();
- args = (zval **)emalloc(ARG_COUNT(ht) * sizeof(zval *));
+ args = (zval ***)emalloc(ARG_COUNT(ht) * sizeof(zval **));
- if (getParametersArray(ht, ARG_COUNT(ht), args) == FAILURE) {
+ if (getParametersArrayEx(ARG_COUNT(ht), args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
for (i=0; i<ARG_COUNT(ht); i++)
{
- _compact_var(EG(active_symbol_table), return_value, args[i]);
+ _compact_var(EG(active_symbol_table), return_value, *args[i]);
}
efree(args);
Create an array containing the range of integers from low to high (inclusive) */
PHP_FUNCTION(range)
{
- zval *zlow, *zhigh;
+ zval **zlow, **zhigh;
int low, high;
- if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&zlow,&zhigh) == FAILURE) {
+ if (ARG_COUNT(ht) != 2 || getParametersEx(2,&zlow,&zhigh) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_long(zlow);
- convert_to_long(zhigh);
- low = zlow->value.lval;
- high = zhigh->value.lval;
+ convert_to_long_ex(zlow);
+ convert_to_long_ex(zhigh);
+ low = (*zlow)->value.lval;
+ high = (*zhigh)->value.lval;
/* allocate an array for return */
if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
+ RETURN_FALSE;
}
for (; low <= high; low++) {
php_error(E_WARNING, "Wrong datatype in shuffle() call");
return;
}
- if (!ParameterPassedByReference(ht,1)) {
- php_error(E_WARNING, "Array not passed by reference in call to shuffle()");
- return;
- }
if (zend_hash_sort((*array)->value.ht, array_data_shuffle, 1) == FAILURE) {
return;
}