]> granicus.if.org Git - php/commitdiff
Added stream_get_wrappers()
authorSara Golemon <pollita@php.net>
Fri, 3 Jan 2003 08:02:36 +0000 (08:02 +0000)
committerSara Golemon <pollita@php.net>
Fri, 3 Jan 2003 08:02:36 +0000 (08:02 +0000)
ext/standard/basic_functions.c
ext/standard/file.c
ext/standard/file.h

index f23eb6b5ba99edbf74e2ef29c9ba4a214442a5ed..2344eb77340ccc1db3f2cff9dadd6a4254cac740 100644 (file)
@@ -670,6 +670,7 @@ function_entry basic_functions[] = {
 
        PHP_FE(stream_get_meta_data,                                                                                    NULL)
        PHP_FE(stream_register_wrapper,                                                                                 NULL)
+       PHP_FE(stream_get_wrappers,                                                                                             NULL)
 
 #if HAVE_SYS_TIME_H || defined(PHP_WIN32)
        PHP_FE(stream_set_timeout,                                                                                              NULL)
index 60135779095b4c7602496e9cc233f44a2ff441a3..cd1042a56b41ca85a1acced7bd799090543cc2e8 100644 (file)
@@ -626,6 +626,31 @@ PHP_FUNCTION(stream_get_meta_data)
 }
 /* }}} */
 
+/* {{{ proto array stream_get_wrappers()
+    Retrieves list of registered stream wrappers */
+PHP_FUNCTION(stream_get_wrappers)
+{
+       HashTable *url_stream_wrappers_hash;
+       char *stream_protocol;
+       int stream_protocol_len = 0;
+
+       if (ZEND_NUM_ARGS() != 0) {
+               WRONG_PARAM_COUNT;
+       }
+
+       if (url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash()) {
+               array_init(return_value);
+               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)) 
+                               add_next_index_string(return_value,stream_protocol,1);
+       } else {
+               RETURN_FALSE;
+       }
+
+}
+/* }}} */
+
 /* {{{ stream_select related functions */
 static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, int *max_fd TSRMLS_DC)
 {
index 1458cf5edd68b0f5d90c0a009a7e18d29ce0135b..28fca3b304e60ed9dedc36d5ec9f30ac1ecba076 100644 (file)
@@ -59,6 +59,7 @@ PHP_FUNCTION(stream_set_blocking);
 PHP_FUNCTION(stream_select);
 PHP_FUNCTION(stream_set_timeout);
 PHP_FUNCTION(stream_set_write_buffer);
+PHP_FUNCTION(stream_get_wrappers);
 PHP_FUNCTION(get_meta_tags);
 PHP_FUNCTION(flock);
 PHP_FUNCTION(fd_set);