summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c2
-rw-r--r--main/SAPI.h2
-rw-r--r--main/fopen_wrappers.c6
-rw-r--r--main/getopt.c8
-rw-r--r--main/main.c4
-rw-r--r--main/output.c2
-rw-r--r--main/php.h2
-rw-r--r--main/php_config.h.in61
-rw-r--r--main/php_getopt.h2
-rw-r--r--main/php_ini.c4
-rw-r--r--main/php_logos.c2
-rw-r--r--main/php_open_temporary_file.c2
-rw-r--r--main/php_output.h2
-rw-r--r--main/php_version.h6
-rw-r--r--main/rfc1867.c2
-rw-r--r--main/streams/cast.c96
-rw-r--r--main/streams/plain_wrapper.c2
-rwxr-xr-xmain/streams/streams.c56
-rw-r--r--main/streams/transports.c17
-rw-r--r--main/streams/xp_socket.c4
20 files changed, 184 insertions, 98 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index e6537fda8..1fd6ffd55 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: SAPI.c 296362 2010-03-18 22:37:25Z andrei $ */
#include <ctype.h>
#include <sys/stat.h>
diff --git a/main/SAPI.h b/main/SAPI.h
index 2e185cb01..020c6f106 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.h 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: SAPI.h 296362 2010-03-18 22:37:25Z andrei $ */
#ifndef SAPI_H
#define SAPI_H
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 20fca2891..015be9703 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: fopen_wrappers.c 298277 2010-04-21 22:22:31Z felipe $ */
/* {{{ includes
*/
@@ -435,8 +435,8 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
}
} else
#endif
- if (PG(doc_root) && path_info && (length = strlen(PG(doc_root)) &&
- IS_ABSOLUTE_PATH(PG(doc_root), length))) {
+ if (PG(doc_root) && path_info && (length = strlen(PG(doc_root))) &&
+ IS_ABSOLUTE_PATH(PG(doc_root), length)) {
filename = emalloc(length + strlen(path_info) + 2);
if (filename) {
memcpy(filename, PG(doc_root), length);
diff --git a/main/getopt.c b/main/getopt.c
index 55f75b2ea..87e694a51 100644
--- a/main/getopt.c
+++ b/main/getopt.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: getopt.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: getopt.c 298026 2010-04-15 11:50:43Z tony2001 $ */
#include <stdio.h>
#include <string.h>
@@ -95,18 +95,20 @@ PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char
if ((pos = php_memnstr(&argv[*optind][arg_start], "=", 1, argv[*optind]+arg_end)) != NULL) {
arg_end = pos-&argv[*optind][arg_start];
arg_start++;
+ } else {
+ arg_end--;
}
-
while (1) {
php_optidx++;
if (opts[php_optidx].opt_char == '-') {
(*optind)++;
return(php_opt_error(argc, argv, *optind-1, optchr, OPTERRARG, show_err));
- } else if (opts[php_optidx].opt_name && !strncmp(&argv[*optind][2], opts[php_optidx].opt_name, arg_end)) {
+ } else if (opts[php_optidx].opt_name && !strncmp(&argv[*optind][2], opts[php_optidx].opt_name, arg_end) && arg_end == strlen(opts[php_optidx].opt_name)) {
break;
}
}
+
optchr = 0;
dash = 0;
arg_start += strlen(opts[php_optidx].opt_name);
diff --git a/main/main.c b/main/main.c
index 8970d06af..45751ad96 100644
--- a/main/main.c
+++ b/main/main.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c 294507 2010-02-04 09:21:02Z pajoye $ */
+/* $Id: main.c 296107 2010-03-12 10:28:59Z jani $ */
/* {{{ includes
*/
@@ -568,7 +568,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
if (PG(error_log) != NULL) {
#ifdef HAVE_SYSLOG_H
if (!strcmp(PG(error_log), "syslog")) {
- php_syslog(LOG_NOTICE, "%.500s", log_message);
+ php_syslog(LOG_NOTICE, "%s", log_message);
PG(in_error_log) = 0;
return;
}
diff --git a/main/output.c b/main/output.c
index 0ebecc488..f7b1e0cf5 100644
--- a/main/output.c
+++ b/main/output.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: output.c 294505 2010-02-04 09:13:14Z pajoye $ */
+/* $Id: output.c 296107 2010-03-12 10:28:59Z jani $ */
#include "php.h"
#include "ext/standard/head.h"
diff --git a/main/php.h b/main/php.h
index 08cf29361..d0d0d420f 100644
--- a/main/php.h
+++ b/main/php.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h 294524 2010-02-04 10:13:54Z pajoye $ */
+/* $Id: php.h 296107 2010-03-12 10:28:59Z jani $ */
#ifndef PHP_H
#define PHP_H
diff --git a/main/php_config.h.in b/main/php_config.h.in
index 4daa3d944..d62d83677 100644
--- a/main/php_config.h.in
+++ b/main/php_config.h.in
@@ -176,6 +176,9 @@
/* Define if you have the chroot function. */
#undef HAVE_CHROOT
+/* Define if you have the clearenv function. */
+#undef HAVE_CLEARENV
+
/* Define if you have the crypt function. */
#undef HAVE_CRYPT
@@ -629,6 +632,9 @@
/* Define if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
+/* Define if you have the <atomic.h> header file. */
+#undef HAVE_ATOMIC_H
+
/* Define if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H
@@ -710,6 +716,9 @@
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
+/* Define if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -782,6 +791,9 @@
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
/* Define if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
@@ -941,6 +953,36 @@
/* Whether you have a Continuity Server */
#undef HAVE_CONTINUITY
+/* define if libevent is available */
+#undef HAVE_LIBEVENT
+
+/* do we have prctl? */
+#undef HAVE_PRCTL
+
+/* do we have clock_gettime? */
+#undef HAVE_CLOCK_GETTIME
+
+/* do we have clock_get_time? */
+#undef HAVE_CLOCK_GET_TIME
+
+/* do we have ptrace? */
+#undef HAVE_PTRACE
+
+/* do we have mach_vm_read? */
+#undef HAVE_MACH_VM_READ
+
+/* /proc/pid/mem interface */
+#undef PROC_MEM_FILE
+
+/* fpm version */
+#undef PHP_FPM_VERSION
+
+/* fpm user name */
+#undef PHP_FPM_USER
+
+/* fpm group name */
+#undef PHP_FPM_GROUP
+
/* */
#undef WITH_ZEUS
@@ -1131,6 +1173,9 @@
#undef HAVE_NANOSLEEP
/* */
+#undef HAVE_NANOSLEEP
+
+/* */
#undef HAVE_LIBRT
/* Define if you have the getaddrinfo function */
@@ -1691,6 +1736,9 @@
/* */
#undef HAVE_LIBICONV
+/* iconv() is aliased to libiconv() in -liconv */
+#undef ICONV_ALIASED_LIBICONV
+
/* */
#undef HAVE_ICONV
@@ -2477,11 +2525,14 @@
/* Whether the system supports extended DES salt */
#undef PHP_EXT_DES_CRYPT
+/* Whether the system supports MD5 salt */
+#undef PHP_MD5_CRYPT
+
/* Whether the system supports SHA512 salt */
-#undef PHP_EXT_SHA512_CRYPT
+#undef PHP_SHA512_CRYPT
/* Whether the system supports SHA256 salt */
-#undef PHP_EXT_SHA256_CRYPT
+#undef PHP_SHA256_CRYPT
/* Whether PHP has to use its own crypt_r for blowfish, des and ext des */
#undef PHP_USE_PHP_CRYPT_R
@@ -2711,6 +2762,9 @@
/* */
#undef HAVE_LIBICONV
+/* iconv() is aliased to libiconv() in -liconv */
+#undef ICONV_ALIASED_LIBICONV
+
/* */
#undef HAVE_ICONV
@@ -2753,6 +2807,9 @@
/* Enable compressed protocol support */
#undef MYSQLND_COMPRESSION_ENABLED
+/* Enable SSL support */
+#undef MYSQLND_SSL_SUPPORTED
+
/* Define if int32_t type is present. */
#undef HAVE_INT32_T
diff --git a/main/php_getopt.h b/main/php_getopt.h
index 34fc3f7da..fab8bc7ff 100644
--- a/main/php_getopt.h
+++ b/main/php_getopt.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_getopt.h 294892 2010-02-11 17:24:43Z johannes $ */
+/* $Id: php_getopt.h 293721 2010-01-19 10:44:36Z johannes $ */
#ifndef PHP_GETOPT_H
#define PHP_GETOPT_H
diff --git a/main/php_ini.c b/main/php_ini.c
index 294b8f2b6..13ed8a5ba 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ini.c 294449 2010-02-03 20:13:18Z pajoye $ */
+/* $Id: php_ini.c 300272 2010-06-08 12:54:11Z tony2001 $ */
#include "php.h"
#include "ext/standard/info.h"
@@ -346,7 +346,9 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
*/
static void php_load_php_extension_cb(void *arg TSRMLS_DC)
{
+#ifdef HAVE_LIBDL
php_load_extension(*((char **) arg), MODULE_PERSISTENT, 0 TSRMLS_CC);
+#endif
}
/* }}} */
diff --git a/main/php_logos.c b/main/php_logos.c
index 10e8218ca..2a76cd780 100644
--- a/main/php_logos.c
+++ b/main/php_logos.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_logos.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: php_logos.c 296107 2010-03-12 10:28:59Z jani $ */
#include "php.h"
#include "logos.h"
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index 583f67a41..15bc1b02e 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 294726 2010-02-07 20:45:46Z pajoye $ */
+/* $Id: php_open_temporary_file.c 294724 2010-02-07 20:15:58Z pajoye $ */
#include "php.h"
diff --git a/main/php_output.h b/main/php_output.h
index 964698f51..9489ee1c2 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_output.h 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: php_output.h 296107 2010-03-12 10:28:59Z jani $ */
#ifndef PHP_OUTPUT_H
#define PHP_OUTPUT_H
diff --git a/main/php_version.h b/main/php_version.h
index 88ecedc02..7be2a1bd6 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -2,7 +2,7 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 3
-#define PHP_RELEASE_VERSION 2
+#define PHP_RELEASE_VERSION 3
#define PHP_EXTRA_VERSION ""
-#define PHP_VERSION "5.3.2"
-#define PHP_VERSION_ID 50302
+#define PHP_VERSION "5.3.3"
+#define PHP_VERSION_ID 50303
diff --git a/main/rfc1867.c b/main/rfc1867.c
index f421b23ab..351c54fd8 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c 294031 2010-01-25 23:26:15Z johannes $ */
+/* $Id: rfc1867.c 296362 2010-03-18 22:37:25Z andrei $ */
/*
* This product includes software developed by the Apache Group
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 2e9ad810c..91174665b 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cast.c 294462 2010-02-03 20:49:03Z pajoye $ */
+/* $Id: cast.c 293732 2010-01-19 13:44:08Z jani $ */
#define _GNU_SOURCE
#include "php.h"
@@ -56,6 +56,7 @@ static int stream_cookie_reader(void *cookie, char *buffer, int size)
{
int ret;
TSRMLS_FETCH();
+
ret = php_stream_read((php_stream*)cookie, buffer, size);
return ret;
}
@@ -63,12 +64,14 @@ static int stream_cookie_reader(void *cookie, char *buffer, int size)
static int stream_cookie_writer(void *cookie, const char *buffer, int size)
{
TSRMLS_FETCH();
+
return php_stream_write((php_stream *)cookie, (char *)buffer, size);
}
static fpos_t stream_cookie_seeker(void *cookie, off_t position, int whence)
{
TSRMLS_FETCH();
+
return (fpos_t)php_stream_seek((php_stream *)cookie, position, whence);
}
@@ -86,6 +89,7 @@ static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
{
ssize_t ret;
TSRMLS_FETCH();
+
ret = php_stream_read(((php_stream *)cookie), buffer, size);
return ret;
}
@@ -93,6 +97,7 @@ static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t size)
{
TSRMLS_FETCH();
+
return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
}
@@ -103,14 +108,16 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
*position = php_stream_seek((php_stream *)cookie, (off_t)*position, whence);
- if (*position == -1)
+ if (*position == -1) {
return -1;
+ }
return 0;
}
# else
static int stream_cookie_seeker(void *cookie, off_t position, int whence)
{
TSRMLS_FETCH();
+
return php_stream_seek((php_stream *)cookie, position, whence);
}
# endif
@@ -153,9 +160,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
stream->readpos = stream->writepos = 0;
}
}
-
+
/* filtered streams can only be cast as stdio, and only when fopencookie is present */
-
+
if (castas == PHP_STREAM_AS_STDIO) {
if (stream->stdiocast) {
if (ret) {
@@ -167,31 +174,33 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
/* if the stream is a stdio stream let's give it a chance to respond
* first, to avoid doubling up the layers of stdio with an fopencookie */
if (php_stream_is(stream, PHP_STREAM_IS_STDIO) &&
- stream->ops->cast &&
- !php_stream_is_filtered(stream) &&
- stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS)
- {
+ stream->ops->cast &&
+ !php_stream_is_filtered(stream) &&
+ stream->ops->cast(stream, castas, ret TSRMLS_CC) == SUCCESS
+ ) {
goto exit_success;
}
-
+
#if HAVE_FOPENCOOKIE
/* if just checking, say yes we can be a FILE*, but don't actually create it yet */
- if (ret == NULL)
+ if (ret == NULL) {
goto exit_success;
+ }
*(FILE**)ret = fopencookie(stream, stream->mode, PHP_STREAM_COOKIE_FUNCTIONS);
if (*ret != NULL) {
off_t pos;
-
+
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_FOPENCOOKIE;
/* If the stream position is not at the start, we need to force
* the stdio layer to believe it's real location. */
pos = php_stream_tell(stream);
- if (pos > 0)
+ if (pos > 0) {
fseek(*ret, pos, SEEK_SET);
-
+ }
+
goto exit_success;
}
@@ -219,11 +228,12 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
if (ret != SUCCESS) {
php_stream_close(newstream);
} else {
- int retcode = php_stream_cast(newstream, castas | flags, (void**)ret, show_err);
+ int retcode = php_stream_cast(newstream, castas | flags, (void **)ret, show_err);
- if (retcode == SUCCESS)
+ if (retcode == SUCCESS) {
rewind(*(FILE**)ret);
-
+ }
+
/* do some specialized cleanup */
if ((flags & PHP_STREAM_CAST_RELEASE)) {
php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
@@ -245,13 +255,13 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
if (show_err) {
/* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */
static const char *cast_names[4] = {
- "STDIO FILE*", "File Descriptor", "Socket Descriptor", "select()able descriptor"
+ "STDIO FILE*",
+ "File Descriptor",
+ "Socket Descriptor",
+ "select()able descriptor"
};
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot represent a stream of type %s as a %s",
- stream->ops->label,
- cast_names[castas]
- );
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot represent a stream of type %s as a %s", stream->ops->label, cast_names[castas]);
}
return FAILURE;
@@ -259,20 +269,20 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
exit_success:
if ((stream->writepos - stream->readpos) > 0 &&
- stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE &&
- (flags & PHP_STREAM_CAST_INTERNAL) == 0) {
+ stream->fclose_stdiocast != PHP_STREAM_FCLOSE_FOPENCOOKIE &&
+ (flags & PHP_STREAM_CAST_INTERNAL) == 0
+ ) {
/* the data we have buffered will be lost to the third party library that
* will be accessing the stream. Emit a warning so that the end-user will
* know that they should try something else */
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "%ld bytes of buffered data lost during stream conversion!",
- (long)(stream->writepos - stream->readpos));
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld bytes of buffered data lost during stream conversion!", (long)(stream->writepos - stream->readpos));
}
-
- if (castas == PHP_STREAM_AS_STDIO && ret)
+
+ if (castas == PHP_STREAM_AS_STDIO && ret) {
stream->stdiocast = *(FILE**)ret;
-
+ }
+
if (flags & PHP_STREAM_CAST_RELEASE) {
php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
}
@@ -290,15 +300,15 @@ PHPAPI FILE * _php_stream_open_wrapper_as_file(char *path, char *mode, int optio
stream = php_stream_open_wrapper_rel(path, mode, options|STREAM_WILL_CAST, opened_path);
- if (stream == NULL)
+ if (stream == NULL) {
return NULL;
-
- if (php_stream_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_TRY_HARD|PHP_STREAM_CAST_RELEASE,
- (void**)&fp, REPORT_ERRORS) == FAILURE)
- {
+ }
+
+ if (php_stream_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_TRY_HARD|PHP_STREAM_CAST_RELEASE, (void**)&fp, REPORT_ERRORS) == FAILURE) {
php_stream_close(stream);
- if (opened_path && *opened_path)
+ if (opened_path && *opened_path) {
efree(*opened_path);
+ }
return NULL;
}
return fp;
@@ -311,21 +321,23 @@ PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstr
assert(newstream != NULL);
*newstream = NULL;
-
+
if (((flags & PHP_STREAM_FORCE_CONVERSION) == 0) && origstream->ops->seek != NULL) {
*newstream = origstream;
return PHP_STREAM_UNCHANGED;
}
-
+
/* Use a tmpfile and copy the old streams contents into it */
- if (flags & PHP_STREAM_PREFER_STDIO)
+ if (flags & PHP_STREAM_PREFER_STDIO) {
*newstream = php_stream_fopen_tmpfile();
- else
+ } else {
*newstream = php_stream_temp_new();
+ }
- if (*newstream == NULL)
+ if (*newstream == NULL) {
return PHP_STREAM_FAILED;
+ }
#if ZEND_DEBUG
(*newstream)->open_filename = origstream->open_filename;
@@ -340,7 +352,7 @@ PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstr
php_stream_close(origstream);
php_stream_seek(*newstream, 0, SEEK_SET);
-
+
return PHP_STREAM_RELEASED;
}
/* }}} */
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index e7642d9d4..2087505ce 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c 295417 2010-02-23 15:04:29Z pajoye $ */
+/* $Id: plain_wrapper.c 295308 2010-02-21 17:44:25Z pajoye $ */
#include "php.h"
#include "php_globals.h"
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 44843d25c..e3f79816a 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c 294550 2010-02-05 00:39:31Z pajoye $ */
+/* $Id: streams.c 299466 2010-05-18 19:39:39Z pajoye $ */
#define _GNU_SOURCE
#include "php.h"
@@ -95,7 +95,7 @@ fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream);
stream->context TSRMLS_CC);
stream->context = NULL;
}
-
+
return 0;
}
@@ -157,7 +157,7 @@ void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *
msg[0] = '\0';
for (i = 0; i < wrapper->err_count; i++) {
strcat(msg, wrapper->err_stack[i]);
- if (i < wrapper->err_count - 1) {
+ if (i < wrapper->err_count - 1) {
strcat(msg, br);
}
}
@@ -263,7 +263,7 @@ fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persiste
if (FAILURE == zend_hash_update(&EG(persistent_list), (char *)persistent_id,
strlen(persistent_id) + 1,
(void *)&le, sizeof(le), NULL)) {
-
+
pefree(ret, 1);
return NULL;
}
@@ -329,7 +329,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
/* make sure everything is saved */
_php_stream_flush(stream, 1 TSRMLS_CC);
-
+
/* If not called from the resource dtor, remove the stream from the resource list. */
if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && remove_rsrc) {
zend_list_delete(stream->rsrc_id);
@@ -403,7 +403,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
pefree(stream->orig_path, stream->is_persistent);
stream->orig_path = NULL;
}
-
+
# if defined(PHP_WIN32)
OutputDebugString(leakinfo);
# else
@@ -474,7 +474,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
} else {
flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC;
}
-
+
/* wind the handle... */
for (filter = stream->readfilters.head; filter; filter = filter->next) {
status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags TSRMLS_CC);
@@ -482,7 +482,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
if (status != PSFS_PASS_ON) {
break;
}
-
+
/* brig_out becomes brig_in.
* brig_in will always be empty here, as the filter MUST attach any un-consumed buckets
* to its own brigade */
@@ -491,7 +491,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
brig_outp = brig_swap;
memset(brig_outp, 0, sizeof(*brig_outp));
}
-
+
switch (status) {
case PSFS_PASS_ON:
/* we get here when the last filter in the chain has data to pass on.
@@ -717,7 +717,7 @@ PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len
} else {
readptr = buf;
avail = buf_len;
- }
+ }
/* Look for EOL */
if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) {
@@ -828,7 +828,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen,
} else {
/* XXX: Should be fine to always read chunk_size */
size_t toread;
-
+
if (grow_mode) {
toread = stream->chunk_size;
} else {
@@ -945,7 +945,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size
stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position TSRMLS_CC);
}
-
+
while (count > 0) {
towrite = count;
if (towrite > stream->chunk_size)
@@ -958,7 +958,7 @@ static size_t _php_stream_write_buffer(php_stream *stream, const char *buf, size
buf += justwrote;
count -= justwrote;
didwrite += justwrote;
-
+
/* Only screw with the buffer if we can seek, otherwise we lose data
* buffered from fifos and sockets */
if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
@@ -1119,11 +1119,11 @@ PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_
if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) {
int ret;
-
+
if (stream->writefilters.head) {
_php_stream_flush(stream, 0 TSRMLS_CC);
}
-
+
switch(whence) {
case SEEK_CUR:
offset = stream->position + offset;
@@ -1186,12 +1186,12 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi
/* try to match the buffer mode as best we can */
if (value == PHP_STREAM_BUFFER_NONE) {
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
- } else {
+ } else if (stream->flags & PHP_STREAM_FLAG_NO_BUFFER) {
stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER;
}
ret = PHP_STREAM_OPTION_RETURN_OK;
break;
-
+
default:
;
}
@@ -1244,7 +1244,7 @@ PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen
int min_room = CHUNK_SIZE / 4;
php_stream_statbuf ssbuf;
- if (maxlen == 0) {
+ if (maxlen == 0) {
return 0;
}
@@ -1343,8 +1343,8 @@ PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, s
php_stream_mmap_unmap_ex(src, mapped);
*len = mapped;
-
- /* we've got at least 1 byte to read.
+
+ /* we've got at least 1 byte to read.
* less than 1 is an error */
if (mapped > 0) {
@@ -1393,7 +1393,7 @@ PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, s
*len = haveread;
- /* we've got at least 1 byte to read.
+ /* we've got at least 1 byte to read.
* less than 1 is an error */
if (haveread > 0 || src->eof) {
@@ -1403,7 +1403,7 @@ PHPAPI size_t _php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, s
}
/* Returns the number of bytes moved.
- * Returns 1 when source len is 0.
+ * Returns 1 when source len is 0.
* Deprecated in favor of php_stream_copy_to_stream_ex() */
ZEND_ATTRIBUTE_DEPRECATED
PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC)
@@ -1457,7 +1457,7 @@ int php_init_stream_wrappers(int module_number TSRMLS_DC)
return (
zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1) == SUCCESS
- &&
+ &&
zend_hash_init(php_get_stream_filters_hash_global(), 0, NULL, NULL, 1) == SUCCESS
&&
zend_hash_init(php_stream_xport_get_hash(), 0, NULL, NULL, 1) == SUCCESS
@@ -1661,13 +1661,13 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
}
return NULL;
}
-
+
return plain_files_wrapper;
}
- if (wrapperpp && (*wrapperpp)->is_url &&
+ if (wrapperpp && (*wrapperpp)->is_url &&
(options & STREAM_DISABLE_URL_PROTECTION) == 0 &&
- (!PG(allow_url_fopen) ||
+ (!PG(allow_url_fopen) ||
(((options & STREAM_OPEN_FOR_INCLUDE) ||
PG(in_user_include)) && !PG(allow_url_include)))) {
if (options & REPORT_ERRORS) {
@@ -1822,7 +1822,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
char *resolved_path = NULL;
char *copy_of_path = NULL;
-
+
if (opened_path) {
*opened_path = NULL;
}
@@ -1871,7 +1871,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
php_stream_close(stream);
stream = NULL;
}
-
+
if (stream) {
stream->wrapper = wrapper;
}
diff --git a/main/streams/transports.c b/main/streams/transports.c
index a35efb2df..9e9990712 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: transports.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: transports.c 296079 2010-03-11 16:37:24Z mike $ */
#include "php.h"
#include "php_streams_int.h"
@@ -157,7 +157,20 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int
ERR_RETURN(error_string, error_text, "bind() failed: %s");
failed = 1;
} else if (flags & STREAM_XPORT_LISTEN) {
- if (0 != php_stream_xport_listen(stream, 5, &error_text TSRMLS_CC)) {
+ zval **zbacklog = NULL;
+ int backlog = 32;
+
+ if (stream->context && php_stream_context_get_option(stream->context, "socket", "backlog", &zbacklog) == SUCCESS) {
+ zval *ztmp = *zbacklog;
+
+ convert_to_long_ex(&ztmp);
+ backlog = Z_LVAL_P(ztmp);
+ if (ztmp != *zbacklog) {
+ zval_ptr_dtor(&ztmp);
+ }
+ }
+
+ if (0 != php_stream_xport_listen(stream, backlog, &error_text TSRMLS_CC)) {
ERR_RETURN(error_string, error_text, "listen() failed: %s");
failed = 1;
}
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 9b039ca93..21bf0b396 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_socket.c 294453 2010-02-03 20:21:40Z pajoye $ */
+/* $Id: xp_socket.c 296079 2010-03-11 16:37:24Z mike $ */
#include "php.h"
#include "ext/standard/file.h"
@@ -324,7 +324,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
switch (xparam->op) {
case STREAM_XPORT_OP_LISTEN:
- xparam->outputs.returncode = (listen(sock->socket, 5) == 0) ? 0: -1;
+ xparam->outputs.returncode = (listen(sock->socket, xparam->inputs.backlog) == 0) ? 0: -1;
return PHP_STREAM_OPTION_RETURN_OK;
case STREAM_XPORT_OP_GET_NAME: