From: Markus Fischer Date: Sat, 8 Jun 2002 10:25:44 +0000 (+0000) Subject: - Since streams are always enabled, instead of just printing 'enabled' we tell X-Git-Tag: php5_5_0~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cd40c2808da10f4dd0f86596af51646475067b4;p=php - Since streams are always enabled, instead of just printing 'enabled' we tell what streams are currently registered. --- diff --git a/ext/standard/info.c b/ext/standard/info.c index 5cea723348..1932b8ad77 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -211,6 +211,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) char php_api_no[9]; char mod_api_no[9]; char ext_api_no[9]; + the_time = time(NULL); ta = php_localtime_r(&the_time, &tmbuf); @@ -277,7 +278,36 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print_table_row(2, "Thread Safety", "disabled" ); #endif - php_info_print_table_row(2, "PHP Streams", "enabled"); + { + HashTable *url_stream_wrappers_hash; + char *stream_protocol, *stream_protocols_buf = NULL; + int stream_protocol_len, stream_protocols_buf_len = 0; + + if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) { + for (zend_hash_internal_pointer_reset(url_stream_wrappers_hash); + zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + zend_hash_move_forward(url_stream_wrappers_hash)) { + if (NULL == (stream_protocols_buf = erealloc(stream_protocols_buf, + stream_protocols_buf_len + stream_protocol_len + 1 /* "\n" */ + 1 /* 0 byte at end */))) { + break; + } + memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len); + stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = '\n'; + stream_protocols_buf_len += stream_protocol_len + 1; + } + if (stream_protocols_buf) { + stream_protocols_buf[stream_protocols_buf_len] = 0; + php_info_print_table_row(2, "Registered PHP Streams", stream_protocols_buf); + efree(stream_protocols_buf); + } else { + // Any chances we will ever hit this? + php_info_print_table_row(2, "Registered PHP Streams", "no streams registered"); + } + } else { + // Any chances we will ever hit this? + php_info_print_table_row(2, "PHP Streams", "disabled"); // ?? + } + } php_info_print_table_end(); diff --git a/main/php_streams.h b/main/php_streams.h index 815b0ea549..e46dc5db35 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -452,6 +452,10 @@ PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_ERR, \ (xmsg), (xcode), 0, 0, NULL TSRMLS_CC); } } while(0) + +/* Give other modules access to the url_stream_wrappers_hash */ +PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash(); + #endif /* diff --git a/main/streams.c b/main/streams.c index 5010fb7130..b65f39feef 100755 --- a/main/streams.c +++ b/main/streams.c @@ -1481,6 +1481,10 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context, return zend_hash_update(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)&optionvalue, sizeof(zval *), NULL); } +PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash() +{ + return &url_stream_wrappers_hash; +} /* * Local variables: