cvs: php4 /ext/standard basic_functions.c

From: Date: Tue, 05 Sep 2000 18:33:02 +0000
Subject: cvs: php4 /ext/standard basic_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1586@lists.php.net to get a copy of this message
stas Tue Sep 5 11:33:02 2000 EDT Modified files: /php4/ext/standard basic_functions.c Log: More fixes fo ini_ handling functions Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.248 php4/ext/standard/basic_functions.c:1.249 --- php4/ext/standard/basic_functions.c:1.248 Tue Sep 5 09:55:32 2000 +++ php4/ext/standard/basic_functions.c Tue Sep 5 11:33:02 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.248 2000/09/05 16:55:32 rasmus Exp $ */ +/* $Id: basic_functions.c,v 1.249 2000/09/05 18:33:02 stas Exp $ */ #include "php.h" #include "php_main.h" @@ -1832,6 +1832,7 @@ PHP_FUNCTION(ini_get) { pval **varname; + char *str; if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &varname)==FAILURE) { WRONG_PARAM_COUNT; @@ -1839,15 +1840,13 @@ convert_to_string_ex(varname); - return_value->value.str.val = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0); + str = php_ini_string((*varname)->value.str.val, (*varname)->value.str.len+1, 0); - if (!return_value->value.str.val) { + if (!str) { RETURN_FALSE; } - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - pval_copy_constructor(return_value); + RETURN_STRING(str,1); } /* }}} */ @@ -1866,13 +1865,14 @@ convert_to_string_ex(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, PHP_INI_STAGE_RUNTIME)==FAILURE) { - RETURN_FALSE; - } + /* copy to return here, because alter might free it! */ if (old_value) { - RETURN_STRING(old_value, 1); + RETVAL_STRING(old_value, 1); } else { + RETVAL_FALSE; + } + + 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, PHP_INI_STAGE_RUNTIME)==FAILURE) { RETURN_FALSE; } }

« previous php.cvs (#1586) next »