summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2003-05-21 09:34:21 +0000
committerZeev Suraski <zeev@php.net>2003-05-21 09:34:21 +0000
commit2127840893fd699284d21d4e6f2666accdb11814 (patch)
tree40ea1aad100acf02b849042da3b018c880ecfef2
parent2e34a6a9a6c4a115278735feade3564fd748735b (diff)
downloadphp-git-2127840893fd699284d21d4e6f2666accdb11814.tar.gz
Revert PHP part of the fd patch
-rw-r--r--NEWS1
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/browscap.c2
-rw-r--r--main/main.c14
-rw-r--r--main/php_ini.c3
-rw-r--r--sapi/aolserver/aolserver.c2
-rw-r--r--sapi/apache/mod_php4.c2
-rw-r--r--sapi/apache/sapi_apache.c2
-rw-r--r--sapi/apache2filter/sapi_apache2.c2
-rw-r--r--sapi/apache2handler/sapi_apache2.c2
-rw-r--r--sapi/caudium/caudium.c2
-rw-r--r--sapi/cgi/cgi_main.c2
-rw-r--r--sapi/cli/php_cli.c27
-rw-r--r--sapi/isapi/php4isapi.c2
-rw-r--r--sapi/nsapi/nsapi.c2
-rw-r--r--sapi/phttpd/phttpd.c2
-rw-r--r--sapi/pi3web/pi3web_sapi.c2
-rw-r--r--sapi/roxen/roxen.c2
-rw-r--r--sapi/servlet/servlet.c2
-rw-r--r--sapi/thttpd/thttpd.c2
-rw-r--r--sapi/tux/php_tux.c2
-rw-r--r--sapi/webjames/webjames.c2
22 files changed, 33 insertions, 48 deletions
diff --git a/NEWS b/NEWS
index d52670c652..36c7fc29db 100644
--- 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.
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 141922ad98..7686bd3370 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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)) {
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 9a7ed303e2..d438b5d091 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -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;
diff --git a/main/main.c b/main/main.c
index ab2032c093..d855b80391 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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
diff --git a/main/php_ini.c b/main/php_ini.c
index c30818965b..2be3459577 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -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]) {
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
index ea2f2ab593..665dd4190c 100644
--- a/sapi/aolserver/aolserver.c
+++ b/sapi/aolserver/aolserver.c
@@ -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;
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index a0cbee47fd..d5f59b21d2 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -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;
diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c
index 3075f25d8f..8b651de012 100644
--- a/sapi/apache/sapi_apache.c
+++ b/sapi/apache/sapi_apache.c
@@ -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;
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
index a0a5a4efbc..ccf3bea4c9 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -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;
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 696c121a55..7c9af93d8b 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -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;
diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c
index 1914430638..6b61060c88 100644
--- a/sapi/caudium/caudium.c
+++ b/sapi/caudium/caudium.c
@@ -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;
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index aebbe90f8f..71c3f57920 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -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 */
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 93515b549b..2f157c4d60 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -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
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
index 88d95ebdaf..fc8f5d9667 100644
--- a/sapi/isapi/php4isapi.c
+++ b/sapi/isapi/php4isapi.c
@@ -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;
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index d3d1bb1d8d..a9ed176d6d 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -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;
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
index 0e662856bd..1928b6060e 100644
--- a/sapi/phttpd/phttpd.c
+++ b/sapi/phttpd/phttpd.c
@@ -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();
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
index 09bb892777..43f784d534 100644
--- a/sapi/pi3web/pi3web_sapi.c
+++ b/sapi/pi3web/pi3web_sapi.c
@@ -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();
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
index d0e5501cce..855e1e90b3 100644
--- a/sapi/roxen/roxen.c
+++ b/sapi/roxen/roxen.c
@@ -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
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
index b3bcd3fe20..c4fceba252 100644
--- a/sapi/servlet/servlet.c
+++ b/sapi/servlet/servlet.c
@@ -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];
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index 344962921a..48054c4394 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -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;
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
index 093e3326cf..7db243773c 100644
--- a/sapi/tux/php_tux.c
+++ b/sapi/tux/php_tux.c
@@ -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;
diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c
index 06e9adb59b..75a55b79c5 100644
--- a/sapi/webjames/webjames.c
+++ b/sapi/webjames/webjames.c
@@ -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;