diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2009-01-27 21:59:46 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2009-01-27 21:59:46 +0000 |
| commit | 10b12d429af7957b480cff180d37e9d3dc3a8e4f (patch) | |
| tree | b98c0d7a8318a52647fd8cc075dd37676dc61b95 | |
| parent | 6e24169120ea2337c84a7b0f4b062ac0997e3973 (diff) | |
| download | php-git-10b12d429af7957b480cff180d37e9d3dc3a8e4f.tar.gz | |
MFB: improved parameter parsing
| -rw-r--r-- | sapi/apache_hooks/php_apache.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c index 4ee6e1529f..d60203f87d 100644 --- a/sapi/apache_hooks/php_apache.c +++ b/sapi/apache_hooks/php_apache.c @@ -222,7 +222,7 @@ static void apache_request_string_slot(int offset, INTERNAL_FUNCTION_PARAMETERS) { zval *id; request_rec *r; - char *old_value, *new_value; + char *old_value, *new_value = NULL; int new_value_len; char **target; @@ -235,19 +235,13 @@ static void apache_request_string_slot(int offset, INTERNAL_FUNCTION_PARAMETERS) target = (char **)((char*)r + offset); old_value = *target; - switch (ZEND_NUM_ARGS()) { - case 0: - break; - case 1: - *target = ap_pstrdup(r->pool, new_value); - break; - default: - WRONG_PARAM_COUNT; - break; + if (new_value) { + *target = ap_pstrdup(r->pool, new_value); } - if (old_value) + if (old_value) { RETURN_STRING(old_value, 1); + } RETURN_EMPTY_STRING(); } |
