summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/config.nw.h316
-rw-r--r--main/fopen_wrappers.c12
-rw-r--r--main/main.c31
-rw-r--r--main/mergesort.c7
-rw-r--r--main/network.c12
-rw-r--r--main/output.c7
-rw-r--r--main/php.h13
-rw-r--r--main/php_config.h.in77
-rw-r--r--main/php_open_temporary_file.c17
-rw-r--r--main/php_sprintf.c4
-rwxr-xr-xmain/php_streams.h13
-rw-r--r--main/php_syslog.h7
-rw-r--r--main/php_variables.c48
-rw-r--r--main/php_version.h4
-rw-r--r--main/reentrancy.c52
-rw-r--r--main/rfc1867.c36
-rw-r--r--main/safe_mode.c7
-rw-r--r--main/snprintf.h9
-rw-r--r--main/streams/php_streams_int.h14
-rw-r--r--main/streams/plain_wrapper.c8
-rwxr-xr-xmain/streams/streams.c60
21 files changed, 268 insertions, 486 deletions
diff --git a/main/config.nw.h b/main/config.nw.h
deleted file mode 100644
index 3a0235090..000000000
--- a/main/config.nw.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id: config.nw.h,v 1.6 2004/01/08 17:33:04 sniper Exp $ */
-
-/* config.nw.h. Configure file for NetWare platform */
-
-
-/* Define if PHP to setup it's own SIGCHLD handler (not needed on NetWare) */
-#define PHP_SIGCHILD 0
-
-/* dns functions found in resolv.lib */
-#define HAVE_LIBBIND 1
-
-#define HAVE_GETSERVBYNAME 1
-#define HAVE_GETSERVBYPORT 1
-#define HAVE_GETPROTOBYNAME 1
-#define HAVE_GETPROTOBYNUMBER 1
-
-/* set to enable bcmath */
-#define HAVE_BCMATH 1
-
-/* set to enable mysql */
-#define HAVE_MYSQL 1
-
-/* set to enable FTP support */
-#define HAVE_FTP 1
-
-/* set to enable SNMP */
-/*#define HAVE_SNMP 1*/
-
-/* defines for PostgreSQL extension */
-#define HAVE_PGSQL 1
-#define PHP_PGSQL_PRIVATE 1
-#define HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT 1
-#define HAVE_PQCLIENTENCODING 1
-#define HAVE_PQCMDTUPLES 1
-#define HAVE_PQOIDVALUE 1
-
-/* set to enable bundled PCRE library */
-#define HAVE_BUNDLED_PCRE 1
-
-/* set to enable bundled expat library */
-/* #define HAVE_LIBEXPAT 1 */ /* For now */
-#define HAVE_WDDX 0
-
-/* set to enable the crypt command */
-/* #define HAVE_CRYPT 1 */
-/* #define HAVE_CRYPT_H 1 */
-
-/* set to enable force cgi redirect */
-#define FORCE_CGI_REDIRECT 0
-
-/* should be added to runtime config*/
-#define PHP_URL_FOPEN 1
-
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-/* ----------------------------------------------------------------
- The following are defaults for run-time configuration
- ---------------------------------------------------------------*/
-
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* this disables "<?expression?>" and "<?=expression?>" */
-#define DEFAULT_SHORT_OPEN_TAG "1"
-
-
-/* ----------------------------------------------------------------
- The following defines are for those modules which require
- external libraries to compile. These will be removed from
- here in a future beta, as these modules will be moved out to dll's
- ---------------------------------------------------------------*/
-#define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
-#undef HAVE_ADABAS
-#undef HAVE_SOLID
-
-
-/* ----------------------------------------------------------------
- The following may or may not be (or need to be) ported to the
- windows environment.
- ---------------------------------------------------------------*/
-
-/* Define if you have the link function. */
-#undef HAVE_LINK
-
-/* Define if you have the symlink function. */
-#undef HAVE_SYMLINK
-
-/* Define if you have the usleep function. */
-#undef HAVE_USLEEP
-
-#define HAVE_GETCWD 1
-/* #define HAVE_POSIX_READDIR_R 1 */ /* We will use readdir() from LibC */
-
-#define NEED_ISBLANK 1
-
-/* ----------------------------------------------------------------
- The following should never need to be played with
- Functions defined to 0 or remarked out are either already
- handled by the standard VC libraries, or are no longer needed, or
- simply will/can not be ported.
-
- DONT TOUCH!!!!! Unless you realy know what your messing with!
- ---------------------------------------------------------------*/
-
-#define DISCARD_PATH 0
-#undef HAVE_SETITIMER
-#undef HAVE_IODBC
-#define HAVE_UODBC 1
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-#define HAVE_LIMITS_H 1
-
-#define HAVE_TZSET 1
-#define HAVE_TZNAME 1
-
-/* Define if you have the flock function. */
-#undef HAVE_FLOCK
-
-/* Define if you have alloca, as a function or macro. */
-/* Though we have alloca(), this seems to be causing some problem with the stack pointer -- hence not using it */
-/* #define HAVE_ALLOCA 1 */
-
-/* Define if you have <sys/time.h> */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have <signal.h> */
-#define HAVE_SIGNAL_H 1
-
-/* Define if your struct stat has st_blksize. */
-#define HAVE_ST_BLKSIZE
-
-/* Define if your struct stat has st_blocks. */
-#define HAVE_ST_BLOCKS
-
-/* Define if your struct stat has st_rdev. */
-#define HAVE_ST_RDEV 1
-
-/* Define if utime(file, NULL) sets file's timestamp to the present. */
-#define HAVE_UTIME_NULL 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 1
-#define HSREGEX 1
-
-#define HAVE_PCRE 1
-
-#define HAVE_LDAP 1
-
-/* Define if you have the gcvt function. */
-/* #define HAVE_GCVT 1 */
-
-/* Define if you have the getlogin function. */
-/* #define HAVE_GETLOGIN 1 */
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the regcomp function. */
-#define HAVE_REGCOMP 1
-
-/* Define if you have the setlocale function. */
-/* #define HAVE_SETLOCALE 1 */ /* LibC doesn't seem to be supporting fully -- hence commenting for now */
-
-#define HAVE_LOCALECONV 1
-
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the setvbuf function. */
-#ifndef HAVE_LIBBIND
-#define HAVE_SETVBUF 1
-#endif
-
-/* Define if you have the snprintf function. */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the tempnam function. */
-#define HAVE_TEMPNAM 1
-
-/* Define if you have the utime function. */
-#define HAVE_UTIME 1
-
-/* Define if you have the <dirent.h> header file. */
-#define HAVE_DIRENT_H 1
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <grp.h> header file. */
-#define HAVE_GRP_H 0
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/socket.h> header file. */
-#ifdef USE_WINSOCK
-#undef HAVE_SYS_SOCKET_H
-#else
-#define HAVE_SYS_SOCKET_H 1 /* Added '1' for '#if' to work */
-#endif
-
-/* Define if you have the <sys/wait.h> header file. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have the <syslog.h> header file. */
-/* #define HAVE_SYSLOG_H 1 */
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1 /* Added '1' for '#if' to work */
-
-/* Define if you have the dl library (-ldl). */
-#define HAVE_LIBDL 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the cuserid function. */
-#define HAVE_CUSERID 0
-
-/* Define if you have the rint function. */
-#undef HAVE_RINT
-
-#define HAVE_STRFTIME 1
-
-/* Defined since unsetenv function is defined in LibC.
- * This is used to destroy env values in the function php_putenv_destructor.
- * If we do not use unsetenv, then the environment variables are directlt manipulated.
- * This will then result in LibC not being able to do the maintenance
- * that is required for NetWare.
- */
-#define HAVE_UNSETENV 1
-
-/* Default directory for loading extensions. */
-#define PHP_EXTENSION_DIR "sys:/php/ext"
-
-#define SIZEOF_INT 4
-
-/* Define directory constants for PHP and PEAR */
-
-/* This is the default configuration file to read */
-#define CONFIGURATION_FILE_PATH "php.ini"
-
-#define APACHE_MODULE_DIR "sys:/apache/modules"
-#define PHP_BINDIR "sys:/php"
-#define PHP_LIBDIR PHP_BINDIR
-#define PHP_DATADIR PHP_BINDIR
-#define PHP_SYSCONFDIR PHP_BINDIR
-#define PHP_LOCALSTATEDIR PHP_BINDIR
-#define PHP_CONFIG_FILE_PATH "sys:/php"
-#define PEAR_INSTALLDIR "sys:/php/pear"
-
-#define PHP_CONFIG_FILE_SCAN_DIR NULL
-#define PHP_EXTENSION_DIR "sys:/php/ext"
-
-#define PHP_INCLUDE_PATH NULL
-
-#define PHP_PREFIX "sys:/php"
-#define PHP_SHLIB_SUFFIX "nlm"
-
-#define USE_CONFIG_FILE 1
-
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index b692cd8a3..516f6cf76 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.170.2.2 2005/03/11 06:55:22 hyanantha Exp $ */
+/* $Id: fopen_wrappers.c,v 1.170.2.4 2005/07/16 12:14:44 hyanantha Exp $ */
/* {{{ includes
*/
@@ -35,14 +35,6 @@
#ifdef PHP_WIN32
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
-#elif defined(NETWARE)
-/*#include <ws2nlm.h>*/
-/*#include <sys/socket.h>*/
-#ifdef NEW_LIBC
-#include <sys/param.h>
-#else
-#include "netware/param.h"
-#endif
#else
#include <sys/param.h>
#endif
@@ -132,7 +124,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
}
/* Check the path */
-#ifdef PHP_WIN32
+#if defined(PHP_WIN32) || defined(NETWARE)
if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
#else
if (strncmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {
diff --git a/main/main.c b/main/main.c
index b45204c54..9f040fa73 100644
--- a/main/main.c
+++ b/main/main.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.604.2.11 2005/03/24 01:11:35 andi Exp $ */
+/* $Id: main.c,v 1.604.2.22 2005/08/16 18:11:34 helly Exp $ */
/* {{{ includes
*/
@@ -32,14 +32,7 @@
#include "win32/signal.h"
#include <process.h>
#elif defined(NETWARE)
-#ifdef NEW_LIBC
#include <sys/timeval.h>
-#else
-#include "netware/time_nw.h"
-#endif
-/*#include "netware/signal_nw.h"*/
-/*#include "netware/env.h"*/ /* Temporary */
-/*#include <process.h>*/
#ifdef USE_WINSOCK
#include <novsock2.h>
#endif
@@ -229,7 +222,7 @@ static PHP_INI_MH(OnUpdateTimeout)
# define PHP_SAFE_MODE_EXEC_DIR ""
#endif
-#ifdef PHP_PROG_SENDMAIL
+#if defined(PHP_PROG_SENDMAIL) && !defined(NETWARE)
# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "
#else
# define DEFAULT_SENDMAIL_PATH NULL
@@ -660,6 +653,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
case E_PARSE:
/* fatal errors are real errors and cannot be made exceptions */
break;
+ case E_STRICT:
+ /* for the sake of BC to old damaged code */
+ break;
case E_NOTICE:
case E_USER_NOTICE:
/* notices are no errors and are not treated as such like E_WARNINGS */
@@ -778,8 +774,8 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
/* restore memory limit */
AG(memory_limit) = PG(memory_limit);
#endif
- zend_bailout();
efree(buffer);
+ zend_bailout();
return;
}
break;
@@ -1162,6 +1158,10 @@ void php_request_shutdown_for_hook(void *dummy)
} zend_end_try();
zend_try {
+ php_shutdown_stream_hashes(TSRMLS_C);
+ } zend_end_try();
+
+ zend_try {
shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
} zend_end_try();
@@ -1184,6 +1184,7 @@ void php_request_shutdown(void *dummy)
* inside zend_executor callback functions.
*/
EG(opline_ptr) = NULL;
+ EG(active_op_array) = NULL;
zend_try {
php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);
@@ -1193,6 +1194,10 @@ void php_request_shutdown(void *dummy)
sapi_send_headers(TSRMLS_C);
} zend_end_try();
+ zend_try {
+ zend_call_destructors(TSRMLS_C);
+ } zend_end_try();
+
if (PG(modules_activated)) zend_try {
php_call_shutdown_functions(TSRMLS_C);
} zend_end_try();
@@ -1224,6 +1229,10 @@ void php_request_shutdown(void *dummy)
} zend_end_try();
zend_try {
+ php_shutdown_stream_hashes(TSRMLS_C);
+ } zend_end_try();
+
+ zend_try {
shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC);
} zend_end_try();
@@ -1430,6 +1439,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);
php_output_register_constants(TSRMLS_C);
php_rfc1867_register_constants(TSRMLS_C);
diff --git a/main/mergesort.c b/main/mergesort.c
index 886030d31..ee32abb4d 100644
--- a/main/mergesort.c
+++ b/main/mergesort.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-/* $Id: mergesort.c,v 1.14 2003/02/19 08:40:18 sniper Exp $ */
+/* $Id: mergesort.c,v 1.14.2.1 2005/06/29 06:28:31 hyanantha Exp $ */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
@@ -66,11 +66,6 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
#include <winsock2.h> /* Includes definition for u_char */
#endif
-#if defined(NETWARE) && !defined(NEW_LIBC)
-/*#include <ws2nlm.h>*/
-#include <sys/socket.h>
-#endif
-
static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC);
diff --git a/main/network.c b/main/network.c
index d209ac94f..c3640df56 100644
--- a/main/network.c
+++ b/main/network.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: network.c,v 1.109.2.3 2005/03/11 08:11:28 hyanantha Exp $ */
+/* $Id: network.c,v 1.109.2.5 2005/07/27 12:43:06 hyanantha Exp $ */
/*#define DEBUG_MAIN_NETWORK 1*/
@@ -28,9 +28,6 @@
#ifdef PHP_WIN32
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
-#elif defined(NETWARE)
-#include <sys/timeval.h>
-#include <sys/param.h>
#else
#include <sys/param.h>
#endif
@@ -783,8 +780,13 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
}
if (sa) {
+ /* free error string recieved during previous iteration (if any) */
+ if (error_string && *error_string) {
+ efree(*error_string);
+ *error_string = NULL;
+ }
+
/* make a connection attempt */
-
n = php_network_connect_socket(sock, sa, socklen, asynchronous,
timeout ? &working_timeout : NULL,
error_string, error_code);
diff --git a/main/output.c b/main/output.c
index f97ad2cd9..4da19e65a 100644
--- a/main/output.c
+++ b/main/output.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: output.c,v 1.164 2004/03/14 23:56:07 helly Exp $ */
+/* $Id: output.c,v 1.164.2.2 2005/08/24 16:20:06 iliaa Exp $ */
#include "php.h"
#include "ext/standard/head.h"
@@ -238,7 +238,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
OG(ob_lock) = 1;
if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC)==SUCCESS) {
- if (!(Z_TYPE_P(alternate_buffer)==IS_BOOL && Z_BVAL_P(alternate_buffer)==0)) {
+ if (alternate_buffer && !(Z_TYPE_P(alternate_buffer)==IS_BOOL && Z_BVAL_P(alternate_buffer)==0)) {
convert_to_string_ex(&alternate_buffer);
final_buffer = Z_STRVAL_P(alternate_buffer);
final_buffer_length = Z_STRLEN_P(alternate_buffer);
@@ -294,6 +294,9 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
OG(ob_nesting_level)--;
if (send_buffer) {
+ if (just_flush) { /* if flush is called prior to proper end, ensure presence of NUL */
+ final_buffer[final_buffer_length] = '\0';
+ }
OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
}
diff --git a/main/php.h b/main/php.h
index d72774f31..98229b984 100644
--- a/main/php.h
+++ b/main/php.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.203.2.9 2005/03/14 09:41:39 hyanantha Exp $ */
+/* $Id: php.h,v 1.203.2.11 2005/06/29 06:41:15 hyanantha Exp $ */
#ifndef PHP_H
#define PHP_H
@@ -247,21 +247,10 @@ END_EXTERN_C()
/* global variables */
-extern pval *data;
#if !defined(PHP_WIN32)
-#ifdef NETWARE
-#ifdef NEW_LIBC
-#define php_sleep sleep
-#else /* NEW_LIBC */
-#define php_sleep delay /* sleep() and usleep() are not available */
-#define usleep delay
-#endif /* NEW_LIBC */
-extern char **environ;
-#else /* NETWARE */
extern char **environ;
#define php_sleep sleep
#define PHP_SLEEP_NON_VOID
-#endif /* NETWARE */
#endif /* !defined(PHP_WIN32) */
#ifdef PHP_PWRITE_64
diff --git a/main/php_config.h.in b/main/php_config.h.in
index 30d03d27c..86c27e667 100644
--- a/main/php_config.h.in
+++ b/main/php_config.h.in
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: acconfig.h,v 1.34.2.2 2005/03/11 06:51:01 hyanantha Exp $ */
+/* $Id: acconfig.h,v 1.34.2.3 2005/07/29 09:20:02 hyanantha Exp $ */
#define ZEND_API
#define ZEND_DLEXPORT
@@ -218,6 +218,9 @@
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
+/* Define if you have the getgroups function. */
+#undef HAVE_GETGROUPS
+
/* Define if you have the getlogin function. */
#undef HAVE_GETLOGIN
@@ -302,6 +305,9 @@
/* Define if you have the ldap_parse_reference function. */
#undef HAVE_LDAP_PARSE_REFERENCE
+/* Define if you have the ldap_parse_result function. */
+#undef HAVE_LDAP_PARSE_RESULT
+
/* Define if you have the ldap_start_tls_s function. */
#undef HAVE_LDAP_START_TLS_S
@@ -341,6 +347,9 @@
/* Define if you have the mkfifo function. */
#undef HAVE_MKFIFO
+/* Define if you have the mknod function. */
+#undef HAVE_MKNOD
+
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
@@ -632,6 +641,9 @@
/* Define if you have the <sys/ipc.h> header file. */
#undef HAVE_SYS_IPC_H
+/* Define if you have the <sys/mkdev.h> header file. */
+#undef HAVE_SYS_MKDEV_H
+
/* Define if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
@@ -740,12 +752,6 @@
/* Enabling BIND8 compatibility for Panther */
#undef BIND_8_COMPAT
-/* hardcode for each of the cross compiler host */
-#undef PHP_OS
-
-/* hardcode for each of the cross compiler host */
-#undef PHP_UNAME
-
/* Whether you have AOLserver */
#undef HAVE_AOLSERVER
@@ -1426,6 +1432,9 @@
#undef HAVE_GD_DYNAMIC_CTX_EX
/* */
+#undef HAVE_GD_GIF_CTX
+
+/* */
#undef HAVE_GD_JPG
/* */
@@ -1690,6 +1699,9 @@
#undef HAVE_ORALDAP
/* */
+#undef HAVE_ORALDAP_10
+
+/* */
#undef HAVE_LDAP
/* Whether 3 arg set_rebind_proc() */
@@ -1753,6 +1765,9 @@
#undef HAVE_DESTROY_SWF_BLOCK
/* */
+#undef HAVE_SWFPREBUILTCLIP
+
+/* */
#undef HAVE_NEW_MING
/* */
@@ -1936,6 +1951,27 @@
#undef HAVE_EMPRESS
/* */
+#undef AIX
+
+/* */
+#undef HPUX
+
+/* */
+#undef LINUX
+
+/* */
+#undef NEUTRINO
+
+/* */
+#undef ISOLARIS
+
+/* */
+#undef SOLARIS
+
+/* */
+#undef UNIXWARE
+
+/* */
#undef HAVE_BIRDSTEP
/* */
@@ -2043,7 +2079,7 @@
/* PostgreSQL 7.4 or later */
#undef HAVE_PGTRANSACTIONSTATUS
-/* Whether libpq is compiled with --enable-multibye */
+/* Whether libpq is compiled with --enable-multibyte */
#undef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
/* Whether to build pgsql as dynamic module */
@@ -2197,6 +2233,9 @@
#undef HAVE_FLUSHIO
/* */
+#undef HAVE_REGEX_T_RE_MAGIC
+
+/* */
#undef HSREGEX
/* */
@@ -2205,6 +2244,9 @@
/* */
#undef REGEX
+/* 1 */
+#undef HAVE_REGEX_T_RE_MAGIC
+
/* see #24142 */
#undef PHP_ROUND_FUZZ
@@ -2427,6 +2469,12 @@
/* */
#undef ZEND_DEBUG
+/* Use Zend memory manager */
+#undef USE_ZEND_ALLOC
+
+/* Use Zend memory manager */
+#undef USE_ZEND_ALLOC
+
/* */
#undef ZTS
@@ -2463,6 +2511,12 @@
/* PHP build date */
#undef PHP_BUILD_DATE
+/* hardcode for each of the cross compiler host */
+#undef PHP_OS
+
+/* hardcode for each of the cross compiler host */
+#undef PHP_UNAME
+
/* uname -a output */
#undef PHP_UNAME
@@ -2538,6 +2592,13 @@ int zend_sprintf(char *buffer, const char *format, ...);
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
+#ifdef NETWARE
+#ifdef USE_WINSOCK
+#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
+#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
+#endif
+#endif
+
/*
* Local variables:
* tab-width: 4
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index b3b345ddb..8caa316bc 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_open_temporary_file.c,v 1.30.2.1 2005/03/11 08:18:14 hyanantha Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.30.2.4 2005/07/16 12:14:45 hyanantha Exp $ */
#include "php.h"
@@ -31,18 +31,12 @@
#include "win32/winutil.h"
#elif defined(NETWARE)
#ifdef USE_WINSOCK
-/*#include <ws2nlm.h>*/
#include <novsock2.h>
#else
#include <sys/socket.h>
#endif
-#ifdef NEW_LIBC
#include <sys/param.h>
#else
-#include "netware/param.h"
-#endif
-#include "netware/mktemp.h"
-#else
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -104,6 +98,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
{
char *trailing_slash;
char *opened_path;
+ int path_len = 0;
int fd = -1;
#ifndef HAVE_MKSTEMP
int open_flags = O_CREAT | O_TRUNC | O_RDWR
@@ -112,19 +107,17 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
#endif
;
#endif
-#ifdef NETWARE
- char *file_path = NULL;
-#endif
-
if (!path) {
return -1;
}
+ path_len = strlen(path);
+
if (!(opened_path = emalloc(MAXPATHLEN))) {
return -1;
}
- if (IS_SLASH(path[strlen(path)-1])) {
+ if (!path_len || IS_SLASH(path[path_len - 1])) {
trailing_slash = "";
} else {
trailing_slash = "/";
diff --git a/main/php_sprintf.c b/main/php_sprintf.c
index 75adf2f5c..fe1d8cb34 100644
--- a/main/php_sprintf.c
+++ b/main/php_sprintf.c
@@ -16,15 +16,13 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sprintf.c,v 1.17.2.4 2005/01/09 21:05:17 sniper Exp $ */
+/* $Id: php_sprintf.c,v 1.17.2.5 2005/07/26 08:38:25 hyanantha Exp $ */
#include <stdio.h>
#include <stdarg.h>
#include "php.h"
#ifdef PHP_WIN32
#include "config.w32.h"
-#elif defined NETWARE
-#include "config.nw.h"
#else
#include <php_config.h>
#endif
diff --git a/main/php_streams.h b/main/php_streams.h
index 1e77827d4..2584ecc19 100755
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_streams.h,v 1.95.2.2 2005/02/22 00:24:50 iliaa Exp $ */
+/* $Id: php_streams.h,v 1.95.2.5 2005/07/16 12:14:45 hyanantha Exp $ */
#ifndef PHP_STREAMS_H
#define PHP_STREAMS_H
@@ -103,11 +103,7 @@ typedef struct _php_stream_filter php_stream_filter;
#include "streams/php_stream_filter_api.h"
typedef struct _php_stream_statbuf {
-#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
- struct stat_libc sb; /* regular info */
-#else
struct stat sb; /* regular info */
-#endif
/* extended info to go here some day: content-type etc. etc. */
} php_stream_statbuf;
@@ -410,10 +406,8 @@ END_EXTERN_C()
#define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */
/* copy up to maxlen bytes from src to dest. If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src).
- * Uses mmap if the src is a plain file and at offset 0
- * To ensure we don't take up too much memory when reading large files, set the default mmap length
- * at this many bytes */
-#define PHP_STREAM_COPY_ALL 2000000
+ * Uses mmap if the src is a plain file and at offset 0 */
+#define PHP_STREAM_COPY_ALL ((size_t)-1)
BEGIN_EXTERN_C()
PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC);
@@ -507,6 +501,7 @@ END_EXTERN_C()
int php_init_stream_wrappers(int module_number TSRMLS_DC);
int php_shutdown_stream_wrappers(int module_number TSRMLS_DC);
+void php_shutdown_stream_hashes(TSRMLS_D);
PHP_RSHUTDOWN_FUNCTION(streams);
BEGIN_EXTERN_C()
diff --git a/main/php_syslog.h b/main/php_syslog.h
index 22d18b1ac..326ddccca 100644
--- a/main/php_syslog.h
+++ b/main/php_syslog.h
@@ -16,18 +16,13 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_syslog.h,v 1.9.2.1 2005/01/09 21:05:17 sniper Exp $ */
+/* $Id: php_syslog.h,v 1.9.2.2 2005/07/22 12:35:09 hyanantha Exp $ */
#ifndef PHP_SYSLOG_H
#define PHP_SYSLOG_H
#ifdef PHP_WIN32
#include "win32/syslog.h"
-#elif defined(NETWARE)
-# include "config.nw.h"
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
#else
#include <php_config.h>
#ifdef HAVE_SYSLOG_H
diff --git a/main/php_variables.c b/main/php_variables.c
index 6ab07fe10..49b89d28a 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.81.2.3 2005/02/17 04:46:10 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.81.2.12 2005/09/01 19:15:51 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -186,7 +186,19 @@ plain_var:
if (!index) {
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
} else {
+ zval **tmp;
char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
+ /*
+ * According to rfc2965, more specific paths are listed above the less specific ones.
+ * If we encounter a duplicate cookie name, we should skip it, since it is not possible
+ * to have the same (plain text) cookie name for the same path and we should not overwrite
+ * more specific cookies with the less specific ones.
+ */
+ if (PG(http_globals)[TRACK_VARS_COOKIE] && symtable1 == Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) &&
+ zend_symtable_find(symtable1, escaped_index, index_len+1, (void **) &tmp) != FAILURE) {
+ efree(escaped_index);
+ break;
+ }
zend_symtable_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
efree(escaped_index);
}
@@ -250,12 +262,21 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
INIT_PZVAL(array_ptr);
switch (arg) {
case PARSE_POST:
+ if (PG(http_globals)[TRACK_VARS_POST]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ }
PG(http_globals)[TRACK_VARS_POST] = array_ptr;
break;
case PARSE_GET:
+ if (PG(http_globals)[TRACK_VARS_GET]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ }
PG(http_globals)[TRACK_VARS_GET] = array_ptr;
break;
case PARSE_COOKIE:
+ if (PG(http_globals)[TRACK_VARS_COOKIE]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ }
PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
break;
}
@@ -500,6 +521,9 @@ static inline void php_register_server_variables(TSRMLS_D)
ALLOC_ZVAL(array_ptr);
array_init(array_ptr);
INIT_PZVAL(array_ptr);
+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ }
PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
PG(magic_quotes_gpc) = 0;
@@ -675,8 +699,8 @@ int php_hash_environment(TSRMLS_D)
PG(http_globals)[i] = dummy_track_vars_array;
}
- zend_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
PG(http_globals)[i]->refcount++;
+ zend_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
if (PG(register_long_arrays)) {
zend_hash_update(&EG(symbol_table), auto_global_records[i].long_name, auto_global_records[i].long_name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
PG(http_globals)[i]->refcount++;
@@ -696,7 +720,18 @@ int php_hash_environment(TSRMLS_D)
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
{
- php_register_server_variables(TSRMLS_C);
+ if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) {
+ php_register_server_variables(TSRMLS_C);
+ } else {
+ zval *server_vars=NULL;
+ ALLOC_ZVAL(server_vars);
+ array_init(server_vars);
+ INIT_PZVAL(server_vars);
+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ }
+ PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
+ }
zend_hash_update(&EG(symbol_table), name, name_len+1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
@@ -716,9 +751,14 @@ static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC
ALLOC_ZVAL(env_vars);
array_init(env_vars);
INIT_PZVAL(env_vars);
+ if (PG(http_globals)[TRACK_VARS_ENV]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
+ }
PG(http_globals)[TRACK_VARS_ENV] = env_vars;
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
+ if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) {
+ php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
+ }
zend_hash_update(&EG(symbol_table), name, name_len+1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
PG(http_globals)[TRACK_VARS_ENV]->refcount++;
diff --git a/main/php_version.h b/main/php_version.h
index b9a1a6906..60279d10e 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -2,6 +2,6 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 0
-#define PHP_RELEASE_VERSION 4
+#define PHP_RELEASE_VERSION 5
#define PHP_EXTRA_VERSION ""
-#define PHP_VERSION "5.0.4"
+#define PHP_VERSION "5.0.5"
diff --git a/main/reentrancy.c b/main/reentrancy.c
index 74312debd..448733b81 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: reentrancy.c,v 1.40 2004/01/08 08:17:54 andi Exp $ */
+/* $Id: reentrancy.c,v 1.40.2.2 2005/07/01 08:00:44 hyanantha Exp $ */
#include <sys/types.h>
#include <string.h>
@@ -29,11 +29,6 @@
#include "win32/readdir.h"
#endif
-#if defined(NETWARE) && !(NEW_LIBC)
-/*#include <ws2nlm.h>*/
-#include <sys/socket.h>
-#endif
-
#include "php_reentrancy.h"
#include "ext/standard/php_rand.h" /* for PHP_RAND_MAX */
@@ -120,51 +115,6 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
#endif
-#if defined(NETWARE)
-/*
- Re-entrant versions of functions seem to be better for loading NLMs in different address space.
- Since we have them now in LibC, we might as well make use of them.
-*/
-
-#define HAVE_LOCALTIME_R 1
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-#define HAVE_GMTIME_R 1
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- /* Modified according to LibC definition */
- if (localtime_r(timep, p_tm) != NULL)
- return (p_tm);
- return (NULL);
-}
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- /* Modified according to LibC definition */
- if (ctime_r(clock, buf) != NULL)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- /* Modified according to LibC definition */
- if (asctime_r(tm, buf) != NULL)
- return (buf);
- return (NULL);
-}
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- /* Modified according to LibC definition */
- if (gmtime_r(timep, p_tm) != NULL)
- return (p_tm);
- return (NULL);
-}
-
-#endif /* NETWARE */
-
#if defined(__BEOS__)
PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
diff --git a/main/rfc1867.c b/main/rfc1867.c
index a97cf5e72..fbed35ca3 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.159.2.11 2005/02/15 00:26:35 iliaa Exp $ */
+/* $Id: rfc1867.c,v 1.159.2.13 2005/07/13 20:51:12 iliaa Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -131,6 +131,7 @@ void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int
#define UPLOAD_ERROR_C 3 /* Partially uploaded */
#define UPLOAD_ERROR_D 4 /* No file uploaded */
#define UPLOAD_ERROR_E 6 /* Missing /tmp or similar directory */
+#define UPLOAD_ERROR_F 7 /* Failed to write file to disk */
void php_rfc1867_register_constants(TSRMLS_D)
{
@@ -140,6 +141,7 @@ void php_rfc1867_register_constants(TSRMLS_D)
REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT);
REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT);
REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT);
+ REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT);
}
static void normalize_protected_variable(char *varname TSRMLS_DC)
@@ -704,7 +706,7 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne
/* read until a boundary condition */
-static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes TSRMLS_DC)
+static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC)
{
int len, max;
char *bound;
@@ -717,6 +719,9 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes TS
/* look for a potential boundary match, only read data up to that point */
if ((bound = php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boundary_next_len, 1))) {
max = bound - self->buf_begin;
+ if (end && php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boundary_next_len, 0)) {
+ *end = 1;
+ }
} else {
max = self->bytes_in_buffer;
}
@@ -753,7 +758,7 @@ static char *multipart_buffer_read_body(multipart_buffer *self TSRMLS_DC)
char buf[FILLUNIT], *out=NULL;
int total_bytes=0, read_bytes=0;
- while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf) TSRMLS_CC))) {
+ while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) {
out = erealloc(out, total_bytes + read_bytes + 1);
memcpy(out + total_bytes, buf, read_bytes);
total_bytes += read_bytes;
@@ -784,7 +789,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
zend_bool magic_quotes_gpc;
multipart_buffer *mbuff;
zval *array_ptr = (zval *) arg;
- FILE *fp;
+ int fd=-1;
zend_llist header;
if (SG(request_info).content_length > SG(post_max_size)) {
@@ -858,6 +863,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
if ((cd = php_mime_get_hdr_value(header, "Content-Disposition"))) {
char *pair=NULL;
+ int end=0;
while (isspace(*cd)) {
++cd;
@@ -969,8 +975,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
if (!skip_upload) {
/* Handle file */
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
- if (!fp) {
+ fd = php_open_temporary_fd(PG(upload_tmp_dir), "php", &temp_filename TSRMLS_CC);
+ if (fd==-1) {
sapi_module.sapi_error(E_WARNING, "File upload error - unable to create a temporary file");
cancel_upload = UPLOAD_ERROR_E;
}
@@ -988,7 +994,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
cancel_upload = UPLOAD_ERROR_D;
}
- while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff) TSRMLS_CC)))
+ end = 0;
+ while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end TSRMLS_CC)))
{
if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) {
#if DEBUG_FILE_UPLOAD
@@ -1001,22 +1008,27 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
#endif
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
- wlen = fwrite(buff, 1, blen, fp);
+ wlen = write(fd, buff, blen);
if (wlen < blen) {
#if DEBUG_FILE_UPLOAD
sapi_module.sapi_error(E_NOTICE, "Only %d bytes were written, expected to write %d", wlen, blen);
#endif
- cancel_upload = UPLOAD_ERROR_C;
+ cancel_upload = UPLOAD_ERROR_F;
} else {
total_bytes += wlen;
}
}
}
- if (fp) { /* may not be initialized if file could not be created */
- fclose(fp);
+ if (fd!=-1) { /* may not be initialized if file could not be created */
+ close(fd);
+ }
+ if (!cancel_upload && !end) {
+#if DEBUG_FILE_UPLOAD
+ sapi_module.sapi_error(E_NOTICE, "Missing mime boundary at the end of the data for file %s", strlen(filename) > 0 ? filename : "");
+#endif
+ cancel_upload = UPLOAD_ERROR_C;
}
-
#if DEBUG_FILE_UPLOAD
if(strlen(filename) > 0 && total_bytes == 0 && !cancel_upload) {
sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename);
diff --git a/main/safe_mode.c b/main/safe_mode.c
index ec3602ba1..bd425a9c0 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: safe_mode.c,v 1.58.2.1 2004/12/01 22:37:47 sesser Exp $ */
+/* $Id: safe_mode.c,v 1.58.2.2 2005/07/16 12:14:45 hyanantha Exp $ */
#include "php.h"
@@ -190,7 +190,12 @@ PHPAPI int php_checkuid_ex(const char *filename, char *fopen_mode, int mode, int
}
PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) {
+#ifdef NETWARE
+ /* NetWare don't have uid*/
+ return 1;
+#else
return php_checkuid_ex(filename, fopen_mode, mode, 0);
+#endif
}
PHPAPI char *php_get_current_user()
diff --git a/main/snprintf.h b/main/snprintf.h
index ad74631b5..1b9457cf7 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: snprintf.h,v 1.27.2.2 2004/11/15 23:14:40 fmk Exp $ */
+/* $Id: snprintf.h,v 1.27.2.3 2005/03/31 07:39:42 sniper Exp $ */
/*
@@ -64,19 +64,22 @@ Example:
#ifndef SNPRINTF_H
#define SNPRINTF_H
+BEGIN_EXTERN_C()
PHPAPI int ap_php_snprintf(char *, size_t, const char *, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+PHPAPI int ap_php_vsnprintf(char *, size_t, const char *, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);
+PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
+END_EXTERN_C()
+
#ifdef snprintf
#undef snprintf
#endif
#define snprintf ap_php_snprintf
-PHPAPI int ap_php_vsnprintf(char *, size_t, const char *, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);
#ifdef vsnprintf
#undef vsnprintf
#endif
#define vsnprintf ap_php_vsnprintf
-PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
#ifdef sprintf
#undef sprintf
#endif
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index e443cdfdb..80f312124 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.h
@@ -16,19 +16,25 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_streams_int.h,v 1.5 2004/01/08 17:33:06 sniper Exp $ */
+/* $Id: php_streams_int.h,v 1.5.2.1 2005/06/07 08:25:29 derick Exp $ */
+
#if ZEND_DEBUG
-#define emalloc_rel_orig(size) \
+
+#if USE_ZEND_ALLOC
+# define emalloc_rel_orig(size) \
( __php_stream_call_depth == 0 \
? _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
: _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
-#define erealloc_rel_orig(ptr, size) \
+# define erealloc_rel_orig(ptr, size) \
( __php_stream_call_depth == 0 \
? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
: _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
-
+#else
+# define emalloc_rel_orig(size) emalloc(size)
+# define erealloc_rel_orig(ptr, size) erealloc(ptr, size)
+#endif
#define pemalloc_rel_orig(size, persistent) ((persistent) ? malloc((size)) : emalloc_rel_orig((size)))
#define perealloc_rel_orig(ptr, size, persistent) ((persistent) ? realloc((ptr), (size)) : erealloc_rel_orig((ptr), (size)))
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 49566d4bb..74f92d17e 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.39.2.3 2004/10/28 05:05:39 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.39.2.7 2005/05/24 10:14:05 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -155,6 +155,7 @@ PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC)
php_stream *stream = php_stream_fopen_from_fd_rel(fd, "r+b", NULL);
if (stream) {
php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
+ stream->wrapper = &php_plain_files_wrapper;
self->temp_file_name = opened_path;
self->lock_flag = LOCK_UN;
@@ -461,6 +462,9 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
/* we were opened as a plain file descriptor, so we
* need fdopen now */
data->file = fdopen(data->fd, stream->mode);
+ if (data->file == NULL) {
+ return FAILURE;
+ }
}
*(FILE**)ret = data->file;
@@ -578,7 +582,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
return 0;
}
- if (!flock(fd, value) || (errno == EWOULDBLOCK && value & LOCK_NB)) {
+ if (!flock(fd, value)) {
data->lock_flag = value;
return 0;
} else {
diff --git a/main/streams/streams.c b/main/streams/streams.c
index b42dd840a..f3a12ba33 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.61.2.6 2005/02/22 00:24:51 iliaa Exp $ */
+/* $Id: streams.c,v 1.61.2.14 2005/06/01 15:11:15 dmitry Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -592,8 +592,9 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS
}
/* just break anyway, to avoid greedy read */
- if (stream->wrapper != &php_plain_files_wrapper)
+ if (stream->wrapper != &php_plain_files_wrapper) {
break;
+ }
}
if (didread > 0) {
@@ -832,6 +833,7 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
{
char *e, *buf;
size_t toread;
+ int skip = 0;
php_stream_fill_read_buffer(stream, maxlen TSRMLS_CC);
@@ -839,15 +841,16 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
toread = maxlen;
} else {
if (delim_len == 1) {
- e = memchr(stream->readbuf, *delim, stream->readbuflen);
+ e = memchr(stream->readbuf + stream->readpos, *delim, stream->writepos - stream->readpos);
} else {
- e = php_memnstr(stream->readbuf, delim, delim_len, (stream->readbuf + stream->readbuflen));
+ e = php_memnstr(stream->readbuf + stream->readpos, delim, delim_len, (stream->readbuf + stream->writepos));
}
if (!e) {
toread = maxlen;
} else {
- toread = e - (char *) stream->readbuf;
+ toread = e - (char *) stream->readbuf - stream->readpos;
+ skip = 1;
}
}
@@ -857,8 +860,12 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
buf = emalloc(toread + 1);
*returned_len = php_stream_read(stream, buf, toread);
-
+
if (*returned_len >= 0) {
+ if (skip) {
+ stream->readpos += delim_len;
+ stream->position += delim_len;
+ }
buf[*returned_len] = '\0';
return buf;
} else {
@@ -1361,6 +1368,21 @@ static void stream_resource_persistent_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC
FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
}
+void php_shutdown_stream_hashes(TSRMLS_D)
+{
+ if (FG(stream_wrappers)) {
+ zend_hash_destroy(FG(stream_wrappers));
+ efree(FG(stream_wrappers));
+ FG(stream_wrappers) = NULL;
+ }
+
+ if (FG(stream_filters)) {
+ zend_hash_destroy(FG(stream_filters));
+ efree(FG(stream_filters));
+ FG(stream_filters) = NULL;
+ }
+}
+
int php_init_stream_wrappers(int module_number TSRMLS_DC)
{
le_stream = zend_register_list_destructors_ex(stream_resource_regular_dtor, NULL, "stream", module_number);
@@ -1396,7 +1418,18 @@ int php_shutdown_stream_wrappers(int module_number TSRMLS_DC)
/* API for registering GLOBAL wrappers */
PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC)
{
- return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL);
+ int i, protocol_len = strlen(protocol);
+
+ for(i = 0; i < protocol_len; i++) {
+ if (!isalnum((int)protocol[i]) &&
+ protocol[i] != '+' &&
+ protocol[i] != '-' &&
+ protocol[i] != '.') {
+ return FAILURE;
+ }
+ }
+
+ return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len, wrapper, sizeof(*wrapper), NULL);
}
PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
@@ -1407,6 +1440,17 @@ PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
/* API for registering VOLATILE wrappers */
PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC)
{
+ int i, protocol_len = strlen(protocol);
+
+ for(i = 0; i < protocol_len; i++) {
+ if (!isalnum((int)protocol[i]) &&
+ protocol[i] != '+' &&
+ protocol[i] != '-' &&
+ protocol[i] != '.') {
+ return FAILURE;
+ }
+ }
+
if (!FG(stream_wrappers)) {
php_stream_wrapper tmpwrapper;
@@ -1415,7 +1459,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_w
zend_hash_copy(FG(stream_wrappers), &url_stream_wrappers_hash, NULL, &tmpwrapper, sizeof(php_stream_wrapper));
}
- return zend_hash_add(FG(stream_wrappers), protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL);
+ return zend_hash_add(FG(stream_wrappers), protocol, protocol_len, wrapper, sizeof(*wrapper), NULL);
}
/* }}} */