[PHP4BETA] CVS update: php4

From: Date: Mon, 26 Apr 1999 17:26:33 +0000
Subject: [PHP4BETA] CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-553@lists.php.net to get a copy of this message
Date: Monday April 26, 1999 @ 13:26 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv18494 Modified Files: Makefile.in SAPI.c configure.in.in fhttpd.c main.c mod_php3.c php.h request_info.c safe_mode.c Log Message: * Get the Apache module to compile again * Get rid of php3_rqst, use SG(server_context) instead (there's still Apache-specific code, but it nuked a global) Index: php4/Makefile.in diff -u php4/Makefile.in:1.23 php4/Makefile.in:1.24 --- php4/Makefile.in:1.23 Sun Apr 25 18:16:44 1999 +++ php4/Makefile.in Mon Apr 26 13:26:32 1999 @@ -24,7 +24,7 @@ # +----------------------------------------------------------------------+ # -# $Id: Makefile.in,v 1.23 1999/04/25 22:16:44 rasmus Exp $ +# $Id: Makefile.in,v 1.24 1999/04/26 17:26:32 zeev Exp $ # prefix = @prefix@ @@ -62,11 +62,11 @@ SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \ configuration-parser.c configuration-scanner.c request_info.c \ safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \ - php_ini.c + php_ini.c SAPI.c OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \ configuration-parser.o configuration-scanner.o request_info.o \ safe_mode.o fopen-wrappers.o php3_realpath.o alloca.o output.o \ - php_ini.o + php_ini.o SAPI.o PHPLIBS = -L@top_srcdir@/libzend -lzend -Lext -lphpext LIBS = $(PHPLIBS) $(EXTRA_LIBS) @LIBS@ Index: php4/SAPI.c diff -u php4/SAPI.c:1.2 php4/SAPI.c:1.3 --- php4/SAPI.c:1.2 Mon Apr 26 10:00:46 1999 +++ php4/SAPI.c Mon Apr 26 13:26:32 1999 @@ -6,6 +6,8 @@ #ifdef ZTS SAPI_API int sapi_globals_id; +#else +sapi_globals_struct sapi_globals; #endif /* A true global (no need for thread safety) */ Index: php4/configure.in.in diff -u php4/configure.in.in:1.21 php4/configure.in.in:1.22 --- php4/configure.in.in:1.21 Sun Apr 25 18:16:44 1999 +++ php4/configure.in.in Mon Apr 26 13:26:32 1999 @@ -1,4 +1,4 @@ -dnl $Id: configure.in.in,v 1.21 1999/04/25 22:16:44 rasmus Exp $ -*- sh -*- +dnl $Id: configure.in.in,v 1.22 1999/04/26 17:26:32 zeev Exp $ -*- sh -*- dnl Process this file with autoconf to produce a configure script. @@ -343,7 +343,7 @@ ]) -APACHE_INSTALL_FILES="$srcdir/mod_php3.* $srcdir/php_version.h libphp3.module" +APACHE_INSTALL_FILES="$srcdir/mod_php3.* $srcdir/php_version.h libphp3.module $srcdir/SAPI.h" AC_MSG_CHECKING(for Apache module support via DSO through APACI) Index: php4/fhttpd.c diff -u php4/fhttpd.c:1.3 php4/fhttpd.c:1.4 --- php4/fhttpd.c:1.3 Fri Apr 23 20:11:48 1999 +++ php4/fhttpd.c Mon Apr 26 13:26:32 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fhttpd.c,v 1.3 1999/04/24 00:11:48 zeev Exp $ */ +/* $Id: fhttpd.c,v 1.4 1999/04/26 17:26:32 zeev Exp $ */ #include "php.h" #include <stdlib.h> @@ -169,7 +169,7 @@ } } -void fhttpd_flush( /*php3_rqst->connection */ void) +void fhttpd_flush(void) { } Index: php4/main.c diff -u php4/main.c:1.34 php4/main.c:1.35 --- php4/main.c:1.34 Mon Apr 26 10:00:46 1999 +++ php4/main.c Mon Apr 26 13:26:32 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.34 1999/04/26 14:00:46 zeev Exp $ */ +/* $Id: main.c,v 1.35 1999/04/26 17:26:32 zeev Exp $ */ #include <stdio.h> @@ -248,27 +248,14 @@ /* True global (no need for thread safety */ static int module_initialized = 0; -#ifndef ZTS - -/* - * Globals yet to be protected - */ - -#if APACHE -request_rec *php3_rqst = NULL; /* request record pointer for apache module version */ -#endif -/* - * End of globals to be protected - */ - -#endif - #if APACHE void php3_apache_puts(const char *s) { - if (php3_rqst) { - rputs(s, php3_rqst); + SLS_FETCH(); + + if (SG(server_context)) { + rputs(s, (request_rec *) SG(server_context)); } else { fputs(s, stdout); } @@ -276,8 +263,10 @@ void php3_apache_putc(char c) { - if (php3_rqst) { - rputc(c, php3_rqst); + SLS_FETCH(); + + if (SG(server_context)) { + rputc(c, (request_rec *) SG(server_context)); } else { fputc(c, stdout); } @@ -288,6 +277,7 @@ { FILE *log_file; PLS_FETCH(); + SLS_FETCH(); /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { @@ -310,11 +300,11 @@ } /* Otherwise fall back to the default logging location. */ #if APACHE - if (php3_rqst) { + if (SG(server_context)) { #if MODULE_MAGIC_NUMBER >= 19970831 - aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, php3_rqst->server, log_message); + aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, log_message); #else - log_error(log_message, php3_rqst->server); + log_error(log_message, ((requset_rec *) SG(server_context))->server); #endif } else { fprintf(stderr, log_message); @@ -581,6 +571,7 @@ break; case ZMSG_MEMORY_LEAK_DETECTED: { ELS_FETCH(); + SLS_FETCH(); if (EG(error_reporting)&E_WARNING) { #if ZEND_DEBUG @@ -590,9 +581,9 @@ snprintf(memory_leak_buf,512,"Possible PHP4 memory leak detected (harmless): 0x%0.8lX, %d bytes from %s:%d", (long) t, t->size, t->filename, t->lineno); # if MODULE_MAGIC_NUMBER >= 19970831 - aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, php3_rqst->server, memory_leak_buf); + aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, memory_leak_buf); # else - log_error(memory_leak_buf,php3_rqst->server); + log_error(memory_leak_buf, ((request_rec *) SG(server_context))->server); # endif # else php3_printf("Freeing 0x%0.8X (%d bytes), allocated in %s on line %d<br>\n",(void *)((char *)t+sizeof(mem_header)+PLATFORM_PADDING),t->size,t->filename,t->lineno); @@ -606,7 +597,7 @@ -int php_request_startup(CLS_D ELS_DC PLS_DC) +int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) { zend_output_startup(); @@ -622,7 +613,7 @@ * memory. */ block_alarms(); - register_cleanup(php3_rqst->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec); + register_cleanup(((request_rec *) SG(server_context))->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec); unblock_alarms(); #endif @@ -935,7 +926,7 @@ { pval **tmp_ptr; register int i; - array_header *arr = table_elts(php3_rqst->subprocess_env); + array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env); table_entry *elts = (table_entry *) arr->elts; int len; @@ -961,8 +952,8 @@ _php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL); } tmp = (pval *) emalloc(sizeof(pval)); - tmp->value.str.len = strlen(php3_rqst->uri); - tmp->value.str.val = estrndup(php3_rqst->uri, tmp->value.str.len); + tmp->value.str.len = strlen(((request_rec *) SG(server_context))->uri); + tmp->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len); tmp->refcount=1; tmp->is_ref=0; tmp->type = IS_STRING; @@ -1171,7 +1162,7 @@ /* some systems are missing these from their header files */ #if APACHE -PHPAPI int apache_php3_module_main(request_rec * r, int fd, int display_source_mode) +PHPAPI int apache_php3_module_main(request_rec *r, int fd, int display_source_mode) { zend_file_handle file_handle; #ifdef ZTS @@ -1182,8 +1173,9 @@ zend_executor_globals *executor_globals=&eg; php_core_globals *core_globals=&pcg; #endif + SLS_FETCH(); - php3_rqst = r; + SG(server_context) = r; if (php_request_startup(CLS_C ELS_CC PLS_CC) == FAILURE) { return FAILURE; Index: php4/mod_php3.c diff -u php4/mod_php3.c:1.11 php4/mod_php3.c:1.12 --- php4/mod_php3.c:1.11 Mon Apr 26 10:00:46 1999 +++ php4/mod_php3.c Mon Apr 26 13:26:32 1999 @@ -28,7 +28,7 @@ | PHP4 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php3.c,v 1.11 1999/04/26 14:00:46 zeev Exp $ */ +/* $Id: mod_php3.c,v 1.12 1999/04/26 17:26:32 zeev Exp $ */ #include "httpd.h" #include "http_config.h" @@ -44,6 +44,7 @@ #include "http_protocol.h" #include "http_request.h" #include "http_log.h" +#include "SAPI.h" /* These are taken out of php_ini.h @@ -101,8 +102,10 @@ static int zend_apache_ub_write(const char *str, uint str_length) { - if (php3_rqst) { - return rwrite(str, str_length, php3_rqst); + SLS_FETCH(); + + if (SG(server_context)) { + return rwrite(str, str_length, (request_rec *) SG(server_context)); } else { return fwrite(str, 1, str_length, stdout); } Index: php4/php.h diff -u php4/php.h:1.13 php4/php.h:1.14 --- php4/php.h:1.13 Mon Apr 26 10:00:46 1999 +++ php4/php.h Mon Apr 26 13:26:32 1999 @@ -28,7 +28,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.13 1999/04/26 14:00:46 zeev Exp $ */ +/* $Id: php.h,v 1.14 1999/04/26 17:26:32 zeev Exp $ */ #ifndef _PHP_H #define _PHP_H @@ -197,9 +197,6 @@ #include "http_log.h" #define BLOCK_INTERRUPTIONS block_alarms #define UNBLOCK_INTERRUPTIONS unblock_alarms -# ifndef THREAD_SAFE -extern request_rec *php3_rqst; -# endif #endif #if HAVE_PWD_H Index: php4/request_info.c diff -u php4/request_info.c:1.5 php4/request_info.c:1.6 --- php4/request_info.c:1.5 Mon Apr 26 10:00:46 1999 +++ php4/request_info.c Mon Apr 26 13:26:32 1999 @@ -28,6 +28,7 @@ */ #include "php.h" +#include "SAPI.h" #ifndef THREAD_SAFE PHPAPI php3_request_info request_info; @@ -194,19 +195,22 @@ int php3_init_request_info(void *conf) { const char *buf; + request_rec *r; + SLS_FETCH(); + r = ((request_rec *) SG(server_context)); request_info.current_user = NULL; request_info.current_user_length = 0; - request_info.filename = php3_rqst->filename; - request_info.request_method = php3_rqst->method; - request_info.query_string = php3_rqst->args; - request_info.content_type = table_get(php3_rqst->subprocess_env, "CONTENT_TYPE"); + request_info.filename = r->filename; + request_info.request_method = r->method; + request_info.query_string = r->args; + request_info.content_type = table_get(r->subprocess_env, "CONTENT_TYPE"); - buf = table_get(php3_rqst->subprocess_env, "CONTENT_LENGTH"); + buf = table_get(r->subprocess_env, "CONTENT_LENGTH"); request_info.content_length = (buf ? atoi(buf) : 0); - request_info.cookies = table_get(php3_rqst->subprocess_env, "HTTP_COOKIE"); + request_info.cookies = table_get(r->subprocess_env, "HTTP_COOKIE"); return SUCCESS; } Index: php4/safe_mode.c diff -u php4/safe_mode.c:1.4 php4/safe_mode.c:1.5 --- php4/safe_mode.c:1.4 Fri Apr 23 20:11:49 1999 +++ php4/safe_mode.c Mon Apr 26 13:26:32 1999 @@ -26,7 +26,7 @@ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.4 1999/04/24 00:11:49 zeev Exp $ */ +/* $Id: safe_mode.c,v 1.5 1999/04/26 17:26:32 zeev Exp $ */ #include "php.h" @@ -39,6 +39,7 @@ #include <sys/stat.h> #include "ext/standard/pageinfo.h" #include "safe_mode.h" +#include "SAPI.h" /* * _php3_checkuid @@ -125,6 +126,7 @@ #endif struct passwd *pwd; int uid; + SLS_FETCH(); if (request_info.current_user) { return request_info.current_user; @@ -140,7 +142,7 @@ uid = statbuf.st_uid; #endif #if APACHE - uid = php3_rqst->finfo.st_uid; + uid = ((request_rec *) SG(server_context))->finfo.st_uid; #endif if ((pwd=getpwuid(uid))==NULL) { -- PHP 4 Beta

« previous php.version4 (#553) next »