summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2014-04-17 11:11:51 +0200
committerOndřej Surý <ondrej@sury.org>2014-04-17 11:11:51 +0200
commit9566c3fcaf4cfaa866ea395ee5d1a480785fef0d (patch)
treed053b8b66afe080ea2250d5fbcdfc21c243d54ab /main
parent30bdcf2392ef8cc7b8b4a07b49367571ae1db286 (diff)
downloadphp-9566c3fcaf4cfaa866ea395ee5d1a480785fef0d.tar.gz
New upstream version 5.6.0~beta1+dfsgupstream/5.6.0_beta1+dfsg
Diffstat (limited to 'main')
-rw-r--r--main/main.c12
-rw-r--r--main/output.c14
-rw-r--r--main/php_config.h.in3
-rw-r--r--main/php_version.h4
-rw-r--r--main/streams/plain_wrapper.c12
-rw-r--r--main/streams/streams.c13
-rw-r--r--main/streams/xp_socket.c3
7 files changed, 44 insertions, 17 deletions
diff --git a/main/main.c b/main/main.c
index abe032af7..60f5a16c4 100644
--- a/main/main.c
+++ b/main/main.c
@@ -419,7 +419,7 @@ static PHP_INI_DISP(display_errors_mode)
*/
static PHP_INI_MH(OnUpdateInternalEncoding)
{
- if (new_value_length) {
+ if (new_value) {
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
@@ -432,7 +432,7 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
*/
static PHP_INI_MH(OnUpdateInputEncoding)
{
- if (new_value_length) {
+ if (new_value) {
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
@@ -445,7 +445,7 @@ static PHP_INI_MH(OnUpdateInputEncoding)
*/
static PHP_INI_MH(OnUpdateOutputEncoding)
{
- if (new_value_length) {
+ if (new_value) {
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
} else {
OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
@@ -597,9 +597,9 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals)
STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals)
- STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("internal_encoding", NULL, PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("input_encoding", NULL, PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("output_encoding", NULL, PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals)
diff --git a/main/output.c b/main/output.c
index 72092e956..1dac7179b 100644
--- a/main/output.c
+++ b/main/output.c
@@ -234,6 +234,13 @@ PHPAPI int php_output_get_status(TSRMLS_D)
* Unbuffered write */
PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
{
+#if PHP_DEBUG
+ if (len > UINT_MAX) {
+ php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; "
+ "output will be truncated %lu => %lu",
+ (unsigned long) len, (unsigned long) (len % UINT_MAX));
+ }
+#endif
if (OG(flags) & PHP_OUTPUT_DISABLED) {
return 0;
}
@@ -248,6 +255,13 @@ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC)
* Buffered write */
PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC)
{
+#if PHP_DEBUG
+ if (len > UINT_MAX) {
+ php_error(E_WARNING, "Attempt to output more than UINT_MAX bytes at once; "
+ "output will be truncated %lu => %lu",
+ (unsigned long) len, (unsigned long) (len % UINT_MAX));
+ }
+#endif
if (OG(flags) & PHP_OUTPUT_DISABLED) {
return 0;
}
diff --git a/main/php_config.h.in b/main/php_config.h.in
index f990346a9..5be595e63 100644
--- a/main/php_config.h.in
+++ b/main/php_config.h.in
@@ -1049,6 +1049,9 @@
/* */
#undef HAVE_LIBPAM
+/* Define to 1 if you have the `pq' library (-lpq). */
+#undef HAVE_LIBPQ
+
/* */
#undef HAVE_LIBRARYMANAGER_H
diff --git a/main/php_version.h b/main/php_version.h
index 201422687..e5763f130 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -3,6 +3,6 @@
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 6
#define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION "alpha3"
-#define PHP_VERSION "5.6.0alpha3"
+#define PHP_EXTRA_VERSION "beta1"
+#define PHP_VERSION "5.6.0beta1"
#define PHP_VERSION_ID 50600
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 6ddfc74a1..5e9e5c7ac 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -482,7 +482,7 @@ static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t *
static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
{
- int fd;
+ php_socket_t fd;
php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
assert(data != NULL);
@@ -506,31 +506,31 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
}
*(FILE**)ret = data->file;
- data->fd = -1;
+ data->fd = SOCK_ERR;
}
return SUCCESS;
case PHP_STREAM_AS_FD_FOR_SELECT:
PHP_STDIOP_GET_FD(fd, data);
- if (fd < 0) {
+ if (SOCK_ERR == fd) {
return FAILURE;
}
if (ret) {
- *(int*)ret = fd;
+ *(php_socket_t *)ret = fd;
}
return SUCCESS;
case PHP_STREAM_AS_FD:
PHP_STDIOP_GET_FD(fd, data);
- if (fd < 0) {
+ if (SOCK_ERR == fd) {
return FAILURE;
}
if (data->file) {
fflush(data->file);
}
if (ret) {
- *(int*)ret = fd;
+ *(php_socket_t *)ret = fd;
}
return SUCCESS;
default:
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 4713db151..9f9661dbf 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -731,6 +731,10 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS
if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) {
toread = stream->ops->read(stream, buf, size TSRMLS_CC);
+ if (toread == (size_t) -1) {
+ /* e.g. underlying read(2) returned -1 */
+ break;
+ }
} else {
php_stream_fill_read_buffer(stream, size TSRMLS_CC);
@@ -1396,11 +1400,16 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC)
p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
if (p) {
- PHPWRITE(p, mapped);
+ do {
+ /* output functions return int, so pass in int max */
+ if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) {
+ bcount += b;
+ }
+ } while (b > 0 && mapped > bcount);
php_stream_mmap_unmap_ex(stream, mapped);
- return mapped;
+ return bcount;
}
}
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 9cef91cbb..a6dc11596 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -588,7 +588,8 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t *
parse_unix_address(xparam, &unix_addr TSRMLS_CC);
- return bind(sock->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr));
+ return bind(sock->socket, (const struct sockaddr *)&unix_addr,
+ (socklen_t) XtOffsetOf(struct sockaddr_un, sun_path) + xparam->inputs.namelen);
}
#endif