diff options
| author | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
|---|---|---|
| committer | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
| commit | 56f8195fe592e79d90c78fb015f39bffa7f39422 (patch) | |
| tree | 6a1bf69bc9cd23fab98c4d3d6c12368b56d26079 /sapi | |
| parent | 599ae4b1b53d46e10447dab8fb4faa2d0517370a (diff) | |
| download | php-git-56f8195fe592e79d90c78fb015f39bffa7f39422.tar.gz | |
- Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
STR_FREE() and zval_dtor() always have to check for it and it slows down
the general case. In addition, it seems that empty_string has been abused
quite a lot, and was used not only for setting zval's but generally in
PHP code instead of "", which wasn't the intention. Last but not least,
nuking empty_string should improve stability as I doubt every place
correctly checked if they are not mistakenly erealloc()'ing it or
calling efree() on it.
NOTE: Some code is probably broken. Each extension maintainer should
check and see that my changes are OK. Also, I haven't had time to touch
PECL yet. Will try and do it tomorrow.
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/apache/mod_php5.c | 2 | ||||
| -rw-r--r-- | sapi/apache2filter/php_functions.c | 4 | ||||
| -rw-r--r-- | sapi/apache2filter/sapi_apache2.c | 2 | ||||
| -rw-r--r-- | sapi/apache2handler/php_functions.c | 10 | ||||
| -rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 2 | ||||
| -rw-r--r-- | sapi/apache_hooks/mod_php5.c | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index 4aac2d2862..083cc8be56 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -235,7 +235,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_ if (elts[i].val) { val = elts[i].val; } else { - val = empty_string; + val = ""; } php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC); } diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c index 5e160ce47a..b3ac9c2c09 100644 --- a/sapi/apache2filter/php_functions.c +++ b/sapi/apache2filter/php_functions.c @@ -165,7 +165,7 @@ PHP_FUNCTION(apache_request_headers) arr = apr_table_elts(ctx->f->r->headers_in); APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; add_assoc_string(return_value, key, val, 1); APR_ARRAY_FOREACH_CLOSE() } @@ -185,7 +185,7 @@ PHP_FUNCTION(apache_response_headers) arr = apr_table_elts(ctx->f->r->headers_out); APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; add_assoc_string(return_value, key, val, 1); APR_ARRAY_FOREACH_CLOSE() } diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index d9eee97493..cf6bec1933 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -220,7 +220,7 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) char *key, *val; APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; php_register_variable(key, val, track_vars_array TSRMLS_CC); APR_ARRAY_FOREACH_CLOSE() diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index eeba18a691..fca55d9c33 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -183,7 +183,7 @@ PHP_FUNCTION(apache_request_headers) arr = apr_table_elts(ctx->r->headers_in); APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; add_assoc_string(return_value, key, val, 1); APR_ARRAY_FOREACH_CLOSE() } @@ -203,7 +203,7 @@ PHP_FUNCTION(apache_response_headers) arr = apr_table_elts(ctx->r->headers_out); APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; add_assoc_string(return_value, key, val, 1); APR_ARRAY_FOREACH_CLOSE() } @@ -423,7 +423,7 @@ PHP_MINFO_FUNCTION(apache) php_info_print_table_header(2, "Variable", "Value"); APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { - val = empty_string; + val = ""; } php_info_print_table_row(2, key, val); APR_ARRAY_FOREACH_CLOSE() @@ -438,7 +438,7 @@ PHP_MINFO_FUNCTION(apache) arr = apr_table_elts(((php_struct *) SG(server_context))->r->headers_in); APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { - val = empty_string; + val = ""; } php_info_print_table_row(2, key, val); APR_ARRAY_FOREACH_CLOSE() @@ -447,7 +447,7 @@ PHP_MINFO_FUNCTION(apache) arr = apr_table_elts(((php_struct *) SG(server_context))->r->headers_out); APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { - val = empty_string; + val = ""; } php_info_print_table_row(2, key, val); APR_ARRAY_FOREACH_CLOSE() diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index f5b133bcc1..e7e9571044 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -215,7 +215,7 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) char *key, *val; APR_ARRAY_FOREACH_OPEN(arr, key, val) - if (!val) val = empty_string; + if (!val) val = ""; php_register_variable(key, val, track_vars_array TSRMLS_CC); APR_ARRAY_FOREACH_CLOSE() diff --git a/sapi/apache_hooks/mod_php5.c b/sapi/apache_hooks/mod_php5.c index 516a465c2b..53beeb0943 100644 --- a/sapi/apache_hooks/mod_php5.c +++ b/sapi/apache_hooks/mod_php5.c @@ -382,7 +382,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_ if (elts[i].val) { val = elts[i].val; } else { - val = empty_string; + val = ""; } php_register_variable(elts[i].key, val, track_vars_array TSRMLS_CC); } |
