diff options
author | Zeev Suraski <zeev@php.net> | 1999-08-02 19:17:14 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-08-02 19:17:14 +0000 |
commit | 3cb1eb047187d53688545ae6f64d4df880298e72 (patch) | |
tree | 7fb20f178b9df5a33a83a2b7537f5614910697c0 /main | |
parent | 07e0885519ccabbd9cebfce7223be657171a6629 (diff) | |
download | php-git-3cb1eb047187d53688545ae6f64d4df880298e72.tar.gz |
Removed '3' from key functions in PHP (maintained compatibility through
php3_compat.h)
Diffstat (limited to 'main')
-rw-r--r-- | main/configuration-parser.y | 40 | ||||
-rw-r--r-- | main/configuration-scanner.l | 2 | ||||
-rw-r--r-- | main/fopen_wrappers.c | 14 | ||||
-rw-r--r-- | main/main.c | 60 | ||||
-rw-r--r-- | main/php.h | 6 | ||||
-rw-r--r-- | main/php3_compat.h | 5 | ||||
-rw-r--r-- | main/php_ini.c | 2 | ||||
-rw-r--r-- | main/rfc1867.c | 20 | ||||
-rw-r--r-- | main/safe_mode.c | 10 | ||||
-rw-r--r-- | main/snprintf.h | 4 |
10 files changed, 84 insertions, 79 deletions
diff --git a/main/configuration-parser.y b/main/configuration-parser.y index e7d1ffb1ff..4c41f7e10f 100644 --- a/main/configuration-parser.y +++ b/main/configuration-parser.y @@ -51,7 +51,7 @@ static HashTable configuration_hash; extern HashTable browser_hash; PHPAPI extern char *php3_ini_path; #endif -static HashTable *active__php3_hash_table; +static HashTable *active_zend_hash_table; static pval *current_section; static char *currently_parsed_filename; @@ -68,7 +68,7 @@ pval *cfg_get_entry(char *name, uint name_length) { pval *tmp; - if (_php3_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) { + if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) { return tmp; } else { return NULL; @@ -80,7 +80,7 @@ PHPAPI int cfg_get_long(char *varname,long *result) { pval *tmp,var; - if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { + if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { *result=(long)NULL; return FAILURE; } @@ -96,7 +96,7 @@ PHPAPI int cfg_get_double(char *varname,double *result) { pval *tmp,var; - if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { + if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { *result=(double)0; return FAILURE; } @@ -112,7 +112,7 @@ PHPAPI int cfg_get_string(char *varname, char **result) { pval *tmp; - if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { + if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) { *result=NULL; return FAILURE; } @@ -139,7 +139,7 @@ static int pvalue_config_destructor(pval *pvalue) static int pvalue_browscap_destructor(pval *pvalue) { if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) { - _php3_hash_destroy(pvalue->value.ht); + zend_hash_destroy(pvalue->value.ht); free(pvalue->value.ht); } return 1; @@ -150,7 +150,7 @@ int php3_init_config(void) { PLS_FETCH(); - if (_php3_hash_init(&configuration_hash, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1)==FAILURE) { + if (zend_hash_init(&configuration_hash, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1)==FAILURE) { return FAILURE; } @@ -224,14 +224,14 @@ int php3_init_config(void) tmp.value.str.val = opened_path; tmp.value.str.len = strlen(opened_path); tmp.type = IS_STRING; - _php3_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(pval),NULL); + zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(pval),NULL); #if 0 - php3_printf("INI file opened at '%s'\n",opened_path); + php_printf("INI file opened at '%s'\n",opened_path); #endif } init_cfg_scanner(); - active__php3_hash_table = &configuration_hash; + active_zend_hash_table = &configuration_hash; parsing_mode = PARSING_MODE_CFG; currently_parsed_filename = "php.ini"; yyparse(); @@ -249,17 +249,17 @@ PHP_MINIT_FUNCTION(browscap) char *browscap = INI_STR("browscap"); if (browscap) { - if (_php3_hash_init(&browser_hash, 0, NULL, (int (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) { + if (zend_hash_init(&browser_hash, 0, NULL, (int (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) { return FAILURE; } cfgin = fopen(browscap, "r"); if (!cfgin) { - php3_error(E_WARNING,"Cannot open '%s' for reading", browscap); + php_error(E_WARNING,"Cannot open '%s' for reading", browscap); return FAILURE; } init_cfg_scanner(); - active__php3_hash_table = &browser_hash; + active_zend_hash_table = &browser_hash; parsing_mode = PARSING_MODE_BROWSCAP; currently_parsed_filename = browscap; yyparse(); @@ -272,7 +272,7 @@ PHP_MINIT_FUNCTION(browscap) int php3_shutdown_config(void) { - _php3_hash_destroy(&configuration_hash); + zend_hash_destroy(&configuration_hash); return SUCCESS; } @@ -280,7 +280,7 @@ int php3_shutdown_config(void) PHP_MSHUTDOWN_FUNCTION(browscap) { if (INI_STR("browscap")) { - _php3_hash_destroy(&browser_hash); + zend_hash_destroy(&browser_hash); } return SUCCESS; } @@ -356,10 +356,10 @@ statement: #endif $3.type = IS_STRING; if (parsing_mode==PARSING_MODE_CFG) { - _php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); + zend_hash_update(active_zend_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); } else if (parsing_mode==PARSING_MODE_BROWSCAP) { php3_str_tolower($1.value.str.val,$1.value.str.len); - _php3_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); + zend_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL); } free($1.value.str.val); } @@ -402,14 +402,14 @@ statement: /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/ tmp.value.ht = (HashTable *) malloc(sizeof(HashTable)); - _php3_hash_init(tmp.value.ht, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1); + zend_hash_init(tmp.value.ht, 0, NULL, (int (*)(void *))pvalue_config_destructor, 1); tmp.type = IS_OBJECT; - _php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) ¤t_section); + zend_hash_update(active_zend_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) ¤t_section); tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len); tmp.value.str.len = $1.value.str.len; tmp.type = IS_STRING; convert_browscap_pattern(&tmp); - _php3_hash_update(current_section->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void *) &tmp, sizeof(pval), NULL); + zend_hash_update(current_section->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void *) &tmp, sizeof(pval), NULL); } free($1.value.str.val); } diff --git a/main/configuration-scanner.l b/main/configuration-scanner.l index 7aa2824c79..7610d828ac 100644 --- a/main/configuration-scanner.l +++ b/main/configuration-scanner.l @@ -175,6 +175,6 @@ void init_cfg_scanner() <INITIAL>. { #if DEBUG - php3_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]); + php_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]); #endif } diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 1660874a0a..b9cf243792 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -172,7 +172,7 @@ PHPAPI int _php3_check_open_basedir(char *path) ptr = end; } - php3_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory."); + php_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory."); efree(pathbuf); return -1; } @@ -289,7 +289,7 @@ PHPAPI FILE *php3_fopen_for_parser(void) fp = NULL; } if (!fp) { - php3_error(E_CORE_ERROR, "Unable to open %s", fn); + php_error(E_CORE_ERROR, "Unable to open %s", fn); STR_FREE(SG(request_info).path_translated); /* for same reason as above */ return NULL; } @@ -449,7 +449,7 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i if (!strncasecmp(path, "http://", 7)) { resource = url_parse((char *) path); if (resource == NULL) { - php3_error(E_WARNING, "Invalid URL specified, %s", path); + php_error(E_WARNING, "Invalid URL specified, %s", path); *issock = BAD_URL; return NULL; } @@ -616,11 +616,11 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i } else if (!strncasecmp(path, "ftp://", 6)) { resource = url_parse((char *) path); if (resource == NULL) { - php3_error(E_WARNING, "Invalid URL specified, %s", path); + php_error(E_WARNING, "Invalid URL specified, %s", path); *issock = BAD_URL; return NULL; } else if (resource->path == NULL) { - php3_error(E_WARNING, "No file-path specified"); + php_error(E_WARNING, "No file-path specified"); free_url(resource); *issock = BAD_URL; return NULL; @@ -739,7 +739,7 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i if (mode[0] == 'r') { /* when reading file, it must exist */ if (result > 299 || result < 200) { - php3_error(E_WARNING, "File not found"); + php_error(E_WARNING, "File not found"); free_url(resource); SOCK_FCLOSE(*socketd); *socketd = 0; @@ -749,7 +749,7 @@ static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, i } else { /* when writing file, it must NOT exist */ if (result <= 299 && result >= 200) { - php3_error(E_WARNING, "File already exists"); + php_error(E_WARNING, "File already exists"); free_url(resource); SOCK_FCLOSE(*socketd); *socketd = 0; diff --git a/main/main.c b/main/main.c index 64452ab90e..230e3fbc1e 100644 --- a/main/main.c +++ b/main/main.c @@ -318,7 +318,7 @@ PHPAPI int php3_write(void *buf, int size) return PHPWRITE(buf, size); } -PHPAPI int php3_printf(const char *format,...) +PHPAPI int php_printf(const char *format,...) { va_list args; int ret; @@ -335,7 +335,7 @@ PHPAPI int php3_printf(const char *format,...) /* extended error handling function */ -PHPAPI void php3_error(int type, const char *format,...) +PHPAPI void php_error(int type, const char *format,...) { va_list args; char *error_filename = NULL; @@ -425,7 +425,7 @@ PHPAPI void php3_error(int type, const char *format,...) if (prepend_string) { PUTS(prepend_string); } - php3_printf("<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno); + php_printf("<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno); if (append_string) { PUTS(append_string); } @@ -446,7 +446,7 @@ PHPAPI void php3_error(int type, const char *format,...) tmp->value.str.len = size; tmp->type = IS_STRING; - _php3_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); + zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); } switch (type) { @@ -467,7 +467,7 @@ static void php3_timeout(int dummy) { PLS_FETCH(); - php3_error(E_ERROR, "Maximum execution time of %s seconds exceeded", INI_STR("max_execution_time")); + php_error(E_ERROR, "Maximum execution time of %s seconds exceeded", INI_STR("max_execution_time")); } #endif @@ -514,7 +514,7 @@ PHP_FUNCTION(set_time_limit) PLS_FETCH(); if (PG(safe_mode)) { - php3_error(E_WARNING, "Cannot set time limit in safe mode"); + php_error(E_WARNING, "Cannot set time limit in safe mode"); RETURN_FALSE; } if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &new_timeout) == FAILURE) { @@ -578,17 +578,17 @@ static void php_message_handler_for_zend(long message, void *data) case ZMSG_FAILED_INCLUDE_FOPEN: { PLS_FETCH(); - php3_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } break; case ZMSG_FAILED_REQUIRE_FOPEN: { PLS_FETCH(); - php3_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); + php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php3_strip_url_passwd((char *) data), STR_PRINT(PG(include_path))); } break; case ZMSG_FAILED_HIGHLIGHT_FOPEN: - php3_error(E_WARNING, "Failed opening '%s' for highlighting", php3_strip_url_passwd((char *) data)); + php_error(E_WARNING, "Failed opening '%s' for highlighting", php3_strip_url_passwd((char *) data)); break; case ZMSG_MEMORY_LEAK_DETECTED: case ZMSG_MEMORY_LEAK_REPEATED: { @@ -662,7 +662,7 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) } if (php3_init_request_info(NULL)) { - php3_printf("Unable to initialize request info.\n"); + php_printf("Unable to initialize request info.\n"); return FAILURE; } @@ -742,7 +742,7 @@ void php_request_shutdown(void *dummy) static int php3_config_ini_startup() { if (php3_init_config() == FAILURE) { - php3_printf("PHP: Unable to parse configuration file.\n"); + php_printf("PHP: Unable to parse configuration file.\n"); return FAILURE; } return SUCCESS; @@ -799,8 +799,8 @@ int php_module_startup(sapi_module_struct *sf) zend_output_startup(); - zuf.error_function = php3_error; - zuf.printf_function = php3_printf; + zuf.error_function = php_error; + zuf.printf_function = php_printf; zuf.write_function = zend_body_write_wrapper; zuf.fopen_function = php_fopen_wrapper_for_zend; zuf.message_handler = php_message_handler_for_zend; @@ -825,7 +825,7 @@ int php_module_startup(sapi_module_struct *sf) #if (WIN32|WINNT) && !(USE_SAPI) /* start up winsock services */ if (WSAStartup(wVersionRequested, &wsaData) != 0) { - php3_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError()); + php_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError()); return FAILURE; } #endif @@ -846,7 +846,7 @@ int php_module_startup(sapi_module_struct *sf) zend_set_utility_values(&zuv); if (module_startup_modules() == FAILURE) { - php3_printf("Unable to start modules\n"); + php_printf("Unable to start modules\n"); return FAILURE; } module_initialized = 1; @@ -904,7 +904,7 @@ void php_module_shutdown() /* in 3.1 some of this should move into sapi */ -int _php3_hash_environment(PLS_D ELS_DC) +int zend_hash_environment(PLS_D ELS_DC) { char **env, *p, *t; unsigned char _gpc_flags[3] = {0,0,0}; @@ -951,7 +951,7 @@ int _php3_hash_environment(PLS_D ELS_DC) tmp->type = IS_STRING; INIT_PZVAL(tmp); /* environmental variables never take precedence over get/post/cookie variables */ - _php3_hash_add(&EG(symbol_table), t, p - *env + 1, &tmp, sizeof(pval *), NULL); + zend_hash_add(&EG(symbol_table), t, p - *env + 1, &tmp, sizeof(pval *), NULL); efree(t); } @@ -976,19 +976,19 @@ int _php3_hash_environment(PLS_D ELS_DC) } INIT_PZVAL(tmp); tmp->type = IS_STRING; - _php3_hash_update(&EG(symbol_table), t, strlen(t)+1, &tmp, sizeof(pval *), NULL); + zend_hash_update(&EG(symbol_table), t, strlen(t)+1, &tmp, sizeof(pval *), NULL); } /* insert special variables */ - if (_php3_hash_find(&EG(symbol_table), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &tmp_ptr) == SUCCESS) { + if (zend_hash_find(&EG(symbol_table), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &tmp_ptr) == SUCCESS) { (*tmp_ptr)->refcount++; - _php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL); + zend_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(((request_rec *) SG(server_context))->uri); tmp->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len); INIT_PZVAL(tmp); tmp->type = IS_STRING; - _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL); + zend_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL); } #else { @@ -998,7 +998,7 @@ int _php3_hash_environment(PLS_D ELS_DC) pi = SG(request_info).request_uri; tmp = (pval *) emalloc(sizeof(pval)); tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1); - tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */ + tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */ tmp->type = IS_STRING; INIT_PZVAL(tmp); #else @@ -1016,11 +1016,11 @@ int _php3_hash_environment(PLS_D ELS_DC) } tmp = (pval *) emalloc(sizeof(pval)); tmp->value.str.val = emalloc(l + 1); - tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */ + tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */ tmp->type = IS_STRING; INIT_PZVAL(tmp); #endif - _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) & tmp, sizeof(pval *), NULL); + zend_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) & tmp, sizeof(pval *), NULL); } #endif @@ -1039,12 +1039,12 @@ void _php3_build_argv(char *s ELS_DC) arr = (pval *) emalloc(sizeof(pval)); arr->value.ht = (HashTable *) emalloc(sizeof(HashTable)); - if (_php3_hash_init(arr->value.ht, 0, NULL, PVAL_PTR_DTOR, 0) == FAILURE) { - php3_error(E_WARNING, "Unable to create argv array"); + if (zend_hash_init(arr->value.ht, 0, NULL, PVAL_PTR_DTOR, 0) == FAILURE) { + php_error(E_WARNING, "Unable to create argv array"); } else { arr->type = IS_ARRAY; INIT_PZVAL(arr); - _php3_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); + zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL); } /* now pick out individual entries */ ss = s; @@ -1060,7 +1060,7 @@ void _php3_build_argv(char *s ELS_DC) tmp->value.str.val = estrndup(ss, tmp->value.str.len); INIT_PZVAL(tmp); count++; - if (_php3_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) { + if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) { if (tmp->type == IS_STRING) { efree(tmp->value.str.val); } @@ -1076,7 +1076,7 @@ void _php3_build_argv(char *s ELS_DC) tmp->value.lval = count; tmp->type = IS_LONG; INIT_PZVAL(tmp); - _php3_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &tmp, sizeof(pval *), NULL); + zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &tmp, sizeof(pval *), NULL); } @@ -1110,7 +1110,7 @@ PHPAPI void php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_ if (setjmp(EG(bailout))!=0) { return; } - _php3_hash_environment(PLS_C ELS_CC); + zend_hash_environment(PLS_C ELS_CC); #if WIN32||WINNT UpdateIniFromRegistry(primary_file->filename); diff --git a/main/php.h b/main/php.h index eee90b356e..d70efbf25c 100644 --- a/main/php.h +++ b/main/php.h @@ -274,9 +274,9 @@ extern char **environ; #endif extern void phperror(char *error); -extern PHPAPI void php3_error(int type, const char *format,...); +extern PHPAPI void php_error(int type, const char *format,...); extern PHPAPI int php3_write(void *buf, int size); -extern PHPAPI int php3_printf(const char *format,...); +extern PHPAPI int php_printf(const char *format,...); extern void php3_log_err(char *log_message); extern int Debug(char *format,...); extern int cfgparse(void); @@ -297,7 +297,7 @@ extern int module_startup_modules(void); extern PHPAPI int php3i_get_le_fp(void); /*from basic functions*/ -extern PHPAPI int _php3_error_log(int opt_err,char *message,char *opt,char *headers); +extern PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers); PHPAPI int cfg_get_long(char *varname, long *result); PHPAPI int cfg_get_double(char *varname, double *result); diff --git a/main/php3_compat.h b/main/php3_compat.h index 5844f96685..85242e323e 100644 --- a/main/php3_compat.h +++ b/main/php3_compat.h @@ -58,6 +58,11 @@ #define _php3_hash_apply_with_argument zend_hash_apply_with_argument +#define php3_error php_error + +#define php3_printf php_printf +#define _php3_sprintf php_sprintf + #define php3_module_entry zend_module_entry diff --git a/main/php_ini.c b/main/php_ini.c index 8cb324df43..4c25faf5b8 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -309,7 +309,7 @@ PHP_INI_DISP(php_ini_color_displayer_cb) value = NULL; } if (value) { - php3_printf("<font color=\"%s\">%s</font>", value, value); + php_printf("<font color=\"%s\">%s</font>", value, value); } else { PUTS("<i>no value</i>;"); } diff --git a/main/rfc1867.c b/main/rfc1867.c index 8888f1af2f..6011c6d9a6 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -81,7 +81,7 @@ void php_mime_split(char *buf, int cnt, char *boundary) if (rem < 31) { SAFE_RETURN; } - php3_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4)); + php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4)); SAFE_RETURN; } loc = memchr(ptr, '\n', rem); @@ -90,7 +90,7 @@ void php_mime_split(char *buf, int cnt, char *boundary) name += 7; s = memchr(name, '\"', loc - name); if (!s) { - php3_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4)); + php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4)); SAFE_RETURN; } if (namebuf) { @@ -106,7 +106,7 @@ void php_mime_split(char *buf, int cnt, char *boundary) rem -= (loc2 - ptr) + 1; ptr = loc2 + 1; } else { - php3_error(E_WARNING, "File upload error - no name component in content disposition"); + php_error(E_WARNING, "File upload error - no name component in content disposition"); SAFE_RETURN; } filename = strstr(s, " filename=\""); @@ -114,7 +114,7 @@ void php_mime_split(char *buf, int cnt, char *boundary) filename += 11; s = memchr(filename, '\"', loc - filename); if (!s) { - php3_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *filename, *(filename + 1), *(filename + 2), *(filename + 3), *(filename + 4)); + php_error(E_WARNING, "File Upload Mime headers garbled [%c%c%c%c%c]", *filename, *(filename + 1), *(filename + 2), *(filename + 3), *(filename + 4)); SAFE_RETURN; } if (filenamebuf) { @@ -153,7 +153,7 @@ void php_mime_split(char *buf, int cnt, char *boundary) loc = memchr(u, *boundary, urem); } if (!loc) { - php3_error(E_WARNING, "File Upload Field Data garbled"); + php_error(E_WARNING, "File Upload Field Data garbled"); SAFE_RETURN; } *(loc - 4) = '\0'; @@ -197,16 +197,16 @@ void php_mime_split(char *buf, int cnt, char *boundary) loc = memchr(u, *boundary, urem); } if (!loc) { - php3_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header"); + php_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header"); SAFE_RETURN; } fn = tempnam(PG(upload_tmp_dir), "php"); if ((loc - ptr - 4) > PG(upload_max_filesize)) { - php3_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf); + php_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf); bytes=0; SET_VAR_STRING(namebuf, estrdup("none")); } else if (max_file_size && ((loc - ptr - 4) > max_file_size)) { - php3_error(E_WARNING, "Max file size exceeded - file [%s] not saved", namebuf); + php_error(E_WARNING, "Max file size exceeded - file [%s] not saved", namebuf); bytes = 0; SET_VAR_STRING(namebuf, estrdup("none")); } else if ((loc - ptr - 4) <= 0) { @@ -215,14 +215,14 @@ void php_mime_split(char *buf, int cnt, char *boundary) } else { fp = fopen(fn, "w"); if (!fp) { - php3_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn); + php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn); SAFE_RETURN; } bytes = fwrite(ptr, 1, loc - ptr - 4, fp); fclose(fp); php3_list_insert(fn,le_uploads); /* Tell PHP about the file so the destructor can unlink it later */ if (bytes < (loc - ptr - 4)) { - php3_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4); + php_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4); } SET_VAR_STRING(namebuf, estrdup(fn)); } diff --git a/main/safe_mode.c b/main/safe_mode.c index e06bca9edb..02bd31b9bf 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -59,7 +59,7 @@ PHPAPI int _php3_checkuid(const char *fn, int mode) { if (mode<3) { ret = stat(fn,&sb); if (ret<0 && mode < 2) { - php3_error(E_WARNING,"Unable to access %s",fn); + php_error(E_WARNING,"Unable to access %s",fn); return(mode); } if (ret>-1) { @@ -82,27 +82,27 @@ PHPAPI int _php3_checkuid(const char *fn, int mode) { ret = stat(fn,&sb); *s='/'; if (ret<0) { - php3_error(E_WARNING, "Unable to access %s",fn); + php_error(E_WARNING, "Unable to access %s",fn); return(0); } duid = sb.st_uid; } else { s = emalloc(MAXPATHLEN+1); if (!getcwd(s,MAXPATHLEN)) { - php3_error(E_WARNING, "Unable to access current working directory"); + php_error(E_WARNING, "Unable to access current working directory"); return(0); } ret = stat(s,&sb); efree(s); if (ret<0) { - php3_error(E_WARNING, "Unable to access %s",s); + php_error(E_WARNING, "Unable to access %s",s); return(0); } duid = sb.st_uid; } if (duid == (uid=_php3_getuid())) return(1); else { - php3_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid); + php_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid); return(0); } } diff --git a/main/snprintf.h b/main/snprintf.h index 11632caa52..4a453b2693 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -30,9 +30,9 @@ extern int ap_vsnprintf(char *, size_t, const char *, va_list ap); #endif #if BROKEN_SPRINTF -int _php3_sprintf (char* s, const char* format, ...); +int php_sprintf (char* s, const char* format, ...); #else -#define _php3_sprintf sprintf +#define php_sprintf sprintf #endif #endif /* _PHP3_SNPRINTF_H */ |