cvs: php4 /ext/standard info.c /main php_streams.h streams.c
| From: | Markus Fischer | Date: | Sat, 08 Jun 2002 10:25:45 +0000 |
| Subject: | cvs: php4 /ext/standard info.c /main php_streams.h streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12257@lists.php.net to get a copy of this message | ||
mfischer Sat Jun 8 06:25:45 2002 EDT
Modified files:
/php4/main streams.c php_streams.h
/php4/ext/standard info.c
Log:
- Since streams are always enabled, instead of just printing 'enabled' we tell
what streams are currently registered.
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.52 php4/main/streams.c:1.53
--- php4/main/streams.c:1.52 Mon Apr 29 20:22:44 2002
+++ php4/main/streams.c Sat Jun 8 06:25:43 2002
@@ -1481,6 +1481,10 @@
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:
Index: php4/main/php_streams.h
diff -u php4/main/php_streams.h:1.32 php4/main/php_streams.h:1.33
--- php4/main/php_streams.h:1.32 Mon Apr 29 20:16:00 2002
+++ php4/main/php_streams.h Sat Jun 8 06:25:43 2002
@@ -452,6 +452,10 @@
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
/*
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.181 php4/ext/standard/info.c:1.182
--- php4/ext/standard/info.c:1.181 Fri May 24 13:25:40 2002
+++ php4/ext/standard/info.c Sat Jun 8 06:25:44 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.181 2002/05/24 17:25:40 sander Exp $ */
+/* $Id: info.c,v 1.182 2002/06/08 10:25:44 mfischer Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -211,6 +211,7 @@
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 @@
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();