]> granicus.if.org Git - php/commitdiff
Revert PHP part of the fd patch
authorZeev Suraski <zeev@php.net>
Wed, 21 May 2003 09:34:21 +0000 (09:34 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 21 May 2003 09:34:21 +0000 (09:34 +0000)
22 files changed:
NEWS
ext/standard/basic_functions.c
ext/standard/browscap.c
main/main.c
main/php_ini.c
sapi/aolserver/aolserver.c
sapi/apache/mod_php4.c
sapi/apache/sapi_apache.c
sapi/apache2filter/sapi_apache2.c
sapi/apache2handler/sapi_apache2.c
sapi/caudium/caudium.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/isapi/php4isapi.c
sapi/nsapi/nsapi.c
sapi/phttpd/phttpd.c
sapi/pi3web/pi3web_sapi.c
sapi/roxen/roxen.c
sapi/servlet/servlet.c
sapi/thttpd/thttpd.c
sapi/tux/php_tux.c
sapi/webjames/webjames.c

diff --git a/NEWS b/NEWS
index d52670c6524e85db34dbae4cf10879c6cae2d81a..36c7fc29db93f307f8da4968c9cf3b42fe4b5453 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,6 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? May 2003, Version 4.3.2
-- Improved the engine to use POSIX/socket IO where feasible. (Sascha)
 - Syncronized bundled GD library with GD 2.0.12. (Ilia)
 - Removed support for GDLIB version 1.x.x (php_gd.dll) on Windows. (Edin)
 - Enabled read-only GIF support in the bundled GDLIB (php_gd2.dll) on Windows.
index 141922ad9879e795e6c015fc001d64bc9f3b58af..7686bd3370c03208e6b54c103f7b516c3c701420 100644 (file)
@@ -2840,7 +2840,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback
 PHP_FUNCTION(parse_ini_file)
 {
        zval **filename, **process_sections;
-       zend_file_handle fh = {0};
+       zend_file_handle fh;
        zend_ini_parser_cb_t ini_parser_cb;
 
        switch (ARG_COUNT(ht)) {
index 9a7ed303e26859baccd6eb0fbb7b874c6780c159..d438b5d091fe4117668c509fd4adc830df8f7372 100644 (file)
@@ -150,7 +150,7 @@ PHP_MINIT_FUNCTION(browscap)
        char *browscap = INI_STR("browscap");
 
        if (browscap) {
-               zend_file_handle fh = {0};
+               zend_file_handle fh;
 
                if (zend_hash_init(&browser_hash, 0, NULL, (dtor_func_t) browscap_entry_dtor, 1)==FAILURE) {
                        return FAILURE;
index ab2032c093fe6d2d253c576956a80bf36e181553..d855b8039136958f1d3d0910236ebcb6fa5496b5 100644 (file)
@@ -763,17 +763,6 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
 }
 /* }}} */
 
-
-/* {{{ php_open_wrapper_for_zend
- */
-static zend_bool php_open_wrapper_for_zend(const char *filename, struct _zend_file_handle *fh)
-{
-       TSRMLS_FETCH();
-
-       return php_stream_open_wrapper_as_file_handle((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, fh);
-}
-/* }}} */
-
 /* {{{ php_get_configuration_directive_for_zend
  */
 static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)
@@ -1107,7 +1096,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
        zuf.printf_function = php_printf;
        zuf.write_function = php_body_write_wrapper;
        zuf.fopen_function = php_fopen_wrapper_for_zend;
-       zuf.open_function = php_open_wrapper_for_zend;
        zuf.message_handler = php_message_handler_for_zend;
        zuf.block_interruptions = sapi_module.block_interruptions;
        zuf.unblock_interruptions = sapi_module.unblock_interruptions;
@@ -1600,7 +1588,7 @@ PHPAPI int php_handle_special_queries(TSRMLS_D)
 PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
 {
        zend_file_handle *prepend_file_p, *append_file_p;
-       zend_file_handle prepend_file = {0}, append_file = {0};
+       zend_file_handle prepend_file, append_file;
 #if HAVE_BROKEN_GETCWD 
        int old_cwd_fd = -1;
 #else
index c30818965b6b95b682b7356dd92640e5ea1dab21..2be34595776fd9d1bfa1deb9482e01474b11b9e5 100644 (file)
@@ -236,7 +236,7 @@ int php_init_config()
        int safe_mode_state;
        char *open_basedir;
        int free_ini_search_path=0;
-       zend_file_handle fh = {0};
+       zend_file_handle fh;
        struct stat sb;
        char ini_file[MAXPATHLEN];
        char *p;
@@ -347,6 +347,7 @@ int php_init_config()
        PG(safe_mode) = 0;
        PG(open_basedir) = NULL;
 
+       memset(&fh, 0, sizeof(fh));
        /* Check if php_ini_path_override is a file */
        if (!sapi_module.php_ini_ignore) {
                if (sapi_module.php_ini_path_override && sapi_module.php_ini_path_override[0]) {
index ea2f2ab593468adcb433325cdb3f0cba7e9af727..665dd4190c15972e9258cdc6557c00a76436d196 100644 (file)
@@ -404,7 +404,7 @@ static sapi_module_struct aolserver_sapi_module = {
 static int
 php_ns_module_main(TSRMLS_D)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 
        file_handle.type = ZEND_HANDLE_FILENAME;
        file_handle.filename = SG(request_info).path_translated;
index a0cbee47fd9b2637e8b6d1402c075b3f68b2b3d7..d5f59b21d2aab5b952224cdd414a3b0bd9aa2355 100644 (file)
@@ -534,7 +534,7 @@ static int send_php(request_rec *r, int display_source_mode, char *filename)
        TSRMLS_FETCH();
 
        if (AP(in_request)) {
-               zend_file_handle fh = {0};
+               zend_file_handle fh;
 
                fh.filename = r->filename;
                fh.opened_path = NULL;
index 3075f25d8fe2dd41473a97350e3cdd0760d325c9..8b651de012788f47a563bb35179efd8d6911a1ec 100644 (file)
@@ -28,7 +28,7 @@
 int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
 {
        int retval = OK;        
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 
        if (php_request_startup(TSRMLS_C) == FAILURE) {
                return FAILURE;
index a0a5a4efbcc9b579d187046b9a3464875d266e91..ccf3bea4c9779d84e18aa1f338f119c7f946a159 100644 (file)
@@ -452,7 +452,7 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
        }
 
        for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {
-               zend_file_handle zfd = {0};
+               zend_file_handle zfd;
 
                if (!ctx->request_processed && APR_BUCKET_IS_FILE(b)) {
                        const char *path;
index 696c121a55a513e901a49f7603af6d41454c6808..7c9af93d8b08acc81ac9e1f4fbfd89c134572dbc 100644 (file)
@@ -514,7 +514,7 @@ static int php_handler(request_rec *r)
                php_get_highlight_struct(&syntax_highlighter_ini);
                highlight_file((char *)r->filename, &syntax_highlighter_ini TSRMLS_CC);
        } else {
-               zend_file_handle zfd = {0};
+               zend_file_handle zfd;
 
                zfd.type = ZEND_HANDLE_FILENAME;
                zfd.filename = (char *) r->filename;
index 1914430638e375366859c5d5b65eb602535aa748..6b61060c88e1f2a2692698a6bdd10a2c4930ae91 100644 (file)
@@ -564,7 +564,7 @@ static sapi_module_struct caudium_sapi_module = {
 static void php_caudium_module_main(php_caudium_request *ureq)
 {
   int res;
-  zend_file_handle file_handle = {0};
+  zend_file_handle file_handle;
 #ifndef USE_PIKE_LEVEL_THREADS
   struct thread_state *state;
   extern struct program *thread_id_prog;
index aebbe90f8f9e10f651b9270f092d6b17deceae9c..71c3f57920323d23a8de998db66ea3f0d985d51a 100644 (file)
@@ -894,7 +894,7 @@ int main(int argc, char *argv[])
 {
        int exit_status = SUCCESS;
        int cgi = 0, c, i, len;
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        int retval = FAILURE;
        char *s;
 /* temporary locals */
index 93515b549b43247b70e545e02e3fc5dac6ebc2f0..2f157c4d60e05e85d8f184ad36c5e8e564490244 100644 (file)
@@ -438,7 +438,7 @@ int main(int argc, char *argv[])
 {
        int exit_status = SUCCESS;
        int c;
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 /* temporary locals */
        int behavior=PHP_MODE_STANDARD;
        int no_headers=1;
@@ -725,7 +725,7 @@ int main(int argc, char *argv[])
                        ap_php_optind++;
                }
                if (script_file) {
-                       if (!(file_handle.handle.fd = VCWD_OPEN(script_file, O_RDONLY | O_BINARY))) {
+                       if (!(file_handle.handle.fp = VCWD_FOPEN(script_file, "rb"))) {
                                SG(headers_sent) = 1;
                                SG(request_info).no_headers = 1;
                                php_printf("Could not open input file: %s.\n", script_file);
@@ -734,30 +734,27 @@ int main(int argc, char *argv[])
                        file_handle.filename = script_file;
                        script_filename = script_file;
                        /* #!php support */
-                       c = 0;
-                       read(file_handle.handle.fd, &c, 1);
+                       c = fgetc(file_handle.handle.fp);
                        if (c == '#') {
                                while (c != 10 && c != 13) {
-                                       /* skip to end of line */
-                                       if (read(file_handle.handle.fd, &c, 1) != 1) 
-                                               break;
+                                       c = fgetc(file_handle.handle.fp);       /* skip to end of line */
                                }
                                /* handle situations where line is terminated by \r\n */
                                if (c == 13) {
-                                       if (read(file_handle.handle.fd, &c, 1) == 1 && c != 10) {
+                                       if (fgetc(file_handle.handle.fp) != 10) {
                                                long pos = ftell(file_handle.handle.fp);
                                                fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
                                        }
                                }
                                is_hashbang = 1;
                        } else {
-                               lseek(file_handle.handle.fd, 0, SEEK_SET);
+                               rewind(file_handle.handle.fp);
                        }
                } else {
                        file_handle.filename = "-";
-                       file_handle.handle.fd = STDIN_FILENO;
+                       file_handle.handle.fp = stdin;
                }
-               file_handle.type = ZEND_HANDLE_FD;
+               file_handle.type = ZEND_HANDLE_FP
                file_handle.opened_path = NULL;
                file_handle.free_filename = 0;
                php_self = file_handle.filename;
@@ -773,7 +770,7 @@ int main(int argc, char *argv[])
 
                if (php_request_startup(TSRMLS_C)==FAILURE) {
                        *arg_excp = arg_free;
-                       zend_file_handle_dtor(&file_handle);
+                       fclose(file_handle.handle.fp);
                        SG(headers_sent) = 1;
                        SG(request_info).no_headers = 1;
                        php_request_shutdown((void *) 0);
@@ -816,7 +813,7 @@ int main(int argc, char *argv[])
                case PHP_MODE_STRIP:
                        if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
                                zend_strip(TSRMLS_C);
-                               zend_file_handle_dtor(&file_handle);
+                               fclose(file_handle.handle.fp);
                        }
                        goto out;
                        break;
@@ -827,7 +824,7 @@ int main(int argc, char *argv[])
                                if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) {
                                        php_get_highlight_struct(&syntax_highlighter_ini);
                                        zend_highlight(&syntax_highlighter_ini TSRMLS_CC);
-                                       zend_file_handle_dtor(&file_handle);
+                                       fclose(file_handle.handle.fp);
                                }
                                goto out;
                        }
@@ -837,7 +834,7 @@ int main(int argc, char *argv[])
                case PHP_MODE_INDENT:
                        open_file_for_scanning(&file_handle TSRMLS_CC);
                        zend_indent();
-                       zend_file_handle_dtor(&file_handle);
+                       fclose(file_handle.handle.fp);
                        goto out;
                        break;
 #endif
index 88d95ebdafbe9d60fc3ab40e98aa47f8d392e2cd..fc8f5d96677a4de3c2a0d642eb36a42c2208b504 100644 (file)
@@ -717,7 +717,7 @@ BOOL exceptionhandler(LPEXCEPTION_POINTERS *e, LPEXCEPTION_POINTERS ep)
 
 DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        zend_bool stack_overflown=0;
 #ifdef PHP_ENABLE_SEH
        LPEXCEPTION_POINTERS e;
index d3d1bb1d8de42cfcfea9320e76dfbdfcb31d2ae5..a9ed176d6da65186a62f9fafa3c6c8204f188365 100644 (file)
@@ -493,7 +493,7 @@ static void nsapi_request_dtor(NSLS_D TSRMLS_DC)
 
 int nsapi_module_main(NSLS_D TSRMLS_DC)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 
        if (php_request_startup(TSRMLS_C) == FAILURE) {
                return FAILURE;
index 0e662856bdc04127aed52b05b1af28502c52ce0d..1928b6060e5cb173279e8628a8a694debdd9365a 100644 (file)
@@ -247,7 +247,7 @@ php_phttpd_request_dtor(TSRMLS_D TSRMLS_DC)
 int php_doit(TSRMLS_D TSRMLS_DC)
 {
        struct stat sb;
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        struct httpinfo *hip = PHG(cip)->hip;
        TSRMLS_FETCH();
 
index 09bb892777f1b1fe9c08c5473ffc25ffd066709c..43f784d5340cf372d3824f45159af1174008aba1 100644 (file)
@@ -387,7 +387,7 @@ static sapi_module_struct pi3web_sapi_module = {
 
 DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        int iRet = PIAPI_COMPLETED;
        TSRMLS_FETCH();
 
index d0e5501cce417375e5573fe616c9b966859ee4ca..855e1e90b3e3109a70860abbe340a3ab86e99c8f 100644 (file)
@@ -575,7 +575,7 @@ static int php_roxen_module_main(TSRMLS_D)
 {
   int res, len;
   char *dir;
-  zend_file_handle file_handle = {0};
+  zend_file_handle file_handle;
 #ifdef ROXEN_USE_ZTS
   GET_THIS();
 #endif
index b3bcd3fe208fb5c9b2b57388e64733d0e1a1e4dc..c4fceba25243295d11cbf6b93991286ffe336e02 100644 (file)
@@ -310,7 +310,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
         jstring contentType, jint contentLength, 
         jstring authUser, jboolean display_source_mode)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        int retval;
 #ifndef VIRTUAL_DIR
        char cwd[MAXPATHLEN];
index 344962921a60e86f0db9c741a39bd29db2b28489..48054c4394999df86c31207fd68ce9d07ec8c45d 100644 (file)
@@ -388,7 +388,7 @@ static sapi_module_struct thttpd_sapi_module = {
 
 static void thttpd_module_main(int show_source TSRMLS_DC)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 
        if (php_request_startup(TSRMLS_C) == FAILURE) {
                return;
index 093e3326cf1019ca1d69cf82778ce49a9f675d91..7db243773c7408408d2b19ee4048666260d2095a 100644 (file)
@@ -296,7 +296,7 @@ static sapi_module_struct tux_sapi_module = {
 
 static void tux_module_main(TSRMLS_D)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
 
        file_handle.type = ZEND_HANDLE_FILENAME;
        file_handle.filename = SG(request_info).path_translated;
index 06e9adb59b9721c6add6ddd931073438a68945a6..75a55b79c59aaf652b446bbb5a1915c2b0ecd917 100644 (file)
@@ -142,7 +142,7 @@ static void sapi_webjames_register_variables(zval *track_vars_array TSRMLS_DC)
 
 static void webjames_module_main(TSRMLS_D)
 {
-       zend_file_handle file_handle = {0};
+       zend_file_handle file_handle;
        FILE *fp=NULL;
        char *path;