diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2009-01-05 16:24:26 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2009-01-05 16:24:26 +0000 |
commit | f0240a0382c7ac38144543965f7c45e57af54665 (patch) | |
tree | c49747e7d5c004d52b4bf1ebdefec935fdd033ad /sapi | |
parent | 9b9cd5421dcbd4d4cabd11acdbdcd437785abf89 (diff) | |
download | php-git-f0240a0382c7ac38144543965f7c45e57af54665.tar.gz |
MFB: Improved parameter handling
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/apache/php_apache.c | 7 | ||||
-rw-r--r-- | sapi/apache2filter/php_functions.c | 7 | ||||
-rw-r--r-- | sapi/apache2handler/php_functions.c | 7 | ||||
-rw-r--r-- | sapi/apache_hooks/php_apache.c | 7 |
4 files changed, 12 insertions, 16 deletions
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index aa7b45f2ad..8438ceb2a3 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -312,18 +312,17 @@ PHP_FUNCTION(apache_child_terminate) Get and set Apache request notes */ PHP_FUNCTION(apache_note) { - char *note_name, *note_val; + char *note_name, *note_val = NULL; int note_name_len, note_val_len; char *old_val; - int arg_count = ZEND_NUM_ARGS(); - if (zend_parse_parameters(arg_count TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { return; } old_val = (char *) table_get(((request_rec *)SG(server_context))->notes, note_name); - if (arg_count == 2) { + if (note_val) { table_set(((request_rec *)SG(server_context))->notes, note_name, note_val); } diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c index 85f477f871..289f386c14 100644 --- a/sapi/apache2filter/php_functions.c +++ b/sapi/apache2filter/php_functions.c @@ -193,12 +193,11 @@ PHP_FUNCTION(apache_response_headers) PHP_FUNCTION(apache_note) { php_struct *ctx; - char *note_name, *note_val; + char *note_name, *note_val = NULL; int note_name_len, note_val_len; char *old_note_val=NULL; - int arg_count = ZEND_NUM_ARGS(); - if (zend_parse_parameters(arg_count TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { return; } @@ -206,7 +205,7 @@ PHP_FUNCTION(apache_note) old_note_val = (char *) apr_table_get(ctx->r->notes, note_name); - if (arg_count == 2) { + if (note_val) { apr_table_set(ctx->r->notes, note_name, note_val); } diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 598b2ce567..45f7ac348d 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -221,12 +221,11 @@ PHP_FUNCTION(apache_response_headers) PHP_FUNCTION(apache_note) { php_struct *ctx; - char *note_name, *note_val; + char *note_name, *note_val = NULL; int note_name_len, note_val_len; char *old_note_val=NULL; - int arg_count = ZEND_NUM_ARGS(); - if (zend_parse_parameters(arg_count TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { return; } @@ -234,7 +233,7 @@ PHP_FUNCTION(apache_note) old_note_val = (char *) apr_table_get(ctx->r->notes, note_name); - if (arg_count == 2) { + if (note_val) { apr_table_set(ctx->r->notes, note_name, note_val); } diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c index 5cdd31ef05..d0191d2929 100644 --- a/sapi/apache_hooks/php_apache.c +++ b/sapi/apache_hooks/php_apache.c @@ -1551,18 +1551,17 @@ PHP_FUNCTION(apache_child_terminate) Get and set Apache request notes */ PHP_FUNCTION(apache_note) { - char *arg_name, *arg_val; + char *arg_name, *arg_val = NULL; int arg_name_len, arg_val_len; char *note_val; - int arg_count = ZEND_NUM_ARGS(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &arg_name, &arg_name_len, &arg_val, &arg_val_len) == FAILURE) { return; } note_val = (char *) table_get(((request_rec *)SG(server_context))->notes, arg_name); - - if (arg_count == 2) { + + if (arg_val) { table_set(((request_rec *)SG(server_context))->notes, arg_name, arg_val); } |