mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-20 07:26:38 +00:00
Compare commits
45
Commits
php-5.6.1
...
php-5.5.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a856d8cc4f | ||
|
|
d0a6b7d124 | ||
|
|
cc1fe72bc9 | ||
|
|
4af06aca40 | ||
|
|
886b8efbee | ||
|
|
af88793d6d | ||
|
|
f68da34119 | ||
|
|
25a18c5d73 | ||
|
|
4cbc55adb1 | ||
|
|
a90785e09a | ||
|
|
29eedc7048 | ||
|
|
28eccb918e | ||
|
|
7319298ffe | ||
|
|
7f1239232e | ||
|
|
1a2a8c6d4e | ||
|
|
859913f6d4 | ||
|
|
91d3cd8559 | ||
|
|
46aa2c396b | ||
|
|
0c982798e0 | ||
|
|
ef39f40445 | ||
|
|
fcbe20d357 | ||
|
|
e6105ffb22 | ||
|
|
2711948d14 | ||
|
|
5d299509b4 | ||
|
|
16e2d954fc | ||
|
|
00e99dcafd | ||
|
|
2bfe92c90f | ||
|
|
28ed0119ac | ||
|
|
408b172017 | ||
|
|
bf046d6d66 | ||
|
|
efa7f87de4 | ||
|
|
7958793342 | ||
|
|
e64da8c20d | ||
|
|
5e977e69e1 | ||
|
|
5d9403f56c | ||
|
|
b8470e19e4 | ||
|
|
00525b824a | ||
|
|
ad0b63cad4 | ||
|
|
8cac75969e | ||
|
|
24b41a23b3 | ||
|
|
6dc6daf7e3 | ||
|
|
3411fe33a2 | ||
|
|
2775dc2b44 | ||
|
|
fdfc31a4f7 | ||
|
|
69ea7f9509 |
No files matched your search
@@ -1,15 +1,43 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2014, PHP 5.5.18
|
||||
16 Oct 2014, PHP 5.5.18
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67985 (Incorrect last used array index copied to new array after
|
||||
unset). (Tjerk)
|
||||
. Fixed bug #67739 (Windows 8.1/Server 2012 R2 OS build number reported
|
||||
as 6.2 (instead of 6.3)). (Christian Wenz)
|
||||
. Fixed bug #67633 (A foreach on an array returned from a function not doing
|
||||
copy-on-write). (Nikita)
|
||||
. Fixed bug #51800 (proc_open on Windows hangs forever). (Anatol)
|
||||
. Fixed bug #68044 (Integer overflow in unserialize() (32-bits only)).
|
||||
(CVE-2014-3669) (Stas)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #68089 (NULL byte injection - cURL lib). (Stas)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68113 (Heap corruption in exif_thumbnail()). (CVE-2014-3670)
|
||||
(Stas)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #65641 (PHP-FPM incorrectly defines the SCRIPT_NAME variable
|
||||
when using Apache, mod_proxy-fcgi and ProxyPass). (Remi)
|
||||
|
||||
- OpenSSL:
|
||||
. Revert regression introduced by fix of bug #41631
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #68103 (Duplicate entry in Reflection for class alias). (Remi)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #67972 (SessionHandler Invalid memory read create_sid()). (Adam)
|
||||
|
||||
11 Sep 2014, PHP 5.5.17
|
||||
- XMLRPC:
|
||||
. Fixed bug #68027 (Global buffer overflow in mkgmtime() function).
|
||||
(CVE-2014-3668) (Stas)
|
||||
|
||||
18 Sep 2014, PHP 5.5.17
|
||||
|
||||
- Core:
|
||||
. Fixed bug #47358 (glob returns error, should be empty array()). (Pierre)
|
||||
@@ -22,8 +50,7 @@ PHP NEWS
|
||||
(Aidas Kasparas)
|
||||
|
||||
- FPM:
|
||||
. Fixed #65641 (PHP-FPM incorrectly defines the SCRIPT_NAME variable when
|
||||
using Apache). (David Zuelke)
|
||||
. Fixed #67606 (FPM with mod_fastcgi/apache2.4 is broken). (David Zuelke)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #41631 (socket timeouts not honored in blocking SSL reads).
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Bug #67633: A foreach on an array returned from a function not doing copy-on-write
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function id($x) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
function &ref_id(&$x) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
$c = 'c';
|
||||
$array = ['a', 'b', $c];
|
||||
|
||||
foreach(id($array) as &$v) {
|
||||
$v .= 'q';
|
||||
}
|
||||
var_dump($array);
|
||||
|
||||
foreach(ref_id($array) as &$v) {
|
||||
$v .= 'q';
|
||||
}
|
||||
var_dump($array);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
[2]=>
|
||||
string(1) "c"
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(2) "aq"
|
||||
[1]=>
|
||||
string(2) "bq"
|
||||
[2]=>
|
||||
&string(2) "cq"
|
||||
}
|
||||
@@ -6231,6 +6231,15 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
|
||||
/* save the location of FETCH_W instruction(s) */
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
|
||||
|
||||
if (zend_is_function_or_method_call(array)) {
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_SEPARATE;
|
||||
SET_NODE(opline->op1, array);
|
||||
SET_UNUSED(opline->op2);
|
||||
opline->result_type = IS_VAR;
|
||||
opline->result.var = opline->op1.var;
|
||||
}
|
||||
} else {
|
||||
is_variable = 0;
|
||||
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=18
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -169,6 +169,11 @@ static int php_curl_option_str(php_curl *ch, long option, const char *str, const
|
||||
{
|
||||
CURLcode error = CURLE_OK;
|
||||
|
||||
if (strlen(str) != len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071100
|
||||
if (make_copy) {
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68089 (NULL byte injection - cURL lib)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$url = "file:///etc/passwd\0http://google.com";
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
||||
bool(false)
|
||||
Done
|
||||
@@ -28,7 +28,7 @@ Features
|
||||
AsynchDNS => Yes
|
||||
CharConv => No
|
||||
Debug => No
|
||||
GSS-Negotiate => Yes
|
||||
GSS-Negotiate => No
|
||||
IDN => Yes
|
||||
IPv6 => Yes
|
||||
krb4 => No
|
||||
|
||||
+610
-608
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -2426,11 +2426,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
|
||||
data_ptr += 8;
|
||||
break;
|
||||
case TAG_FMT_SINGLE:
|
||||
memmove(data_ptr, &info_data->value.f, byte_count);
|
||||
memmove(data_ptr, &info_value->f, 4);
|
||||
data_ptr += 4;
|
||||
break;
|
||||
case TAG_FMT_DOUBLE:
|
||||
memmove(data_ptr, &info_data->value.d, byte_count);
|
||||
memmove(data_ptr, &info_value->d, 8);
|
||||
data_ptr += 8;
|
||||
break;
|
||||
}
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #68113 (Heap corruption in exif_thumbnail())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
|
||||
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
|
||||
bool(false)
|
||||
Done
|
||||
+2
-2
@@ -156,12 +156,12 @@ if test "\$PHP_$EXTNAME" != "no"; then
|
||||
|
||||
dnl PHP_CHECK_LIBRARY(\$LIBNAME,\$LIBSYMBOL,
|
||||
dnl [
|
||||
dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/lib, ${EXTNAME}_SHARED_LIBADD)
|
||||
dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/\$PHP_LIBDIR, ${EXTNAME}_SHARED_LIBADD)
|
||||
dnl AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ])
|
||||
dnl ],[
|
||||
dnl AC_MSG_ERROR([wrong $extname lib version or lib not found])
|
||||
dnl ],[
|
||||
dnl -L\$${EXTNAME}_DIR/lib -lm
|
||||
dnl -L\$${EXTNAME}_DIR/\$PHP_LIBDIR -lm
|
||||
dnl ])
|
||||
dnl
|
||||
dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD)
|
||||
|
||||
@@ -1269,7 +1269,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
|
||||
* the sign extension must have happened.
|
||||
*/
|
||||
case FILE_BYTE:
|
||||
v = (char) v;
|
||||
v = (signed char) v;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10 and < 2.4.12
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.10
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.10') < 0) die('skip for freetype >= 2.4.10');
|
||||
if(version_compare(get_freetype_version(), '2.4.12') >= 0) die('skip for freetype < 2.4.12');
|
||||
if(version_compare(get_freetype_version(), '2.4.10') == -1) die('skip for freetype >= 2.4.10');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
@@ -21,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(156, 15)
|
||||
(156, -48)
|
||||
(15%d, 15)
|
||||
(15%d, -48)
|
||||
(-1, -48)
|
||||
@@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Bug #48801 (Problem with imagettfbbox) freetype >= 2.4.12
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imageftbbox')) die('skip imageftbbox() not available');
|
||||
|
||||
include dirname(__FILE__) . '/func.inc';
|
||||
if(version_compare(get_freetype_version(), '2.4.12') < 0) die('skip for freetype >= 2.4.12');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = dirname(__FILE__);
|
||||
$font = "$cwd/Tuffy.ttf";
|
||||
$bbox = imageftbbox(50, 0, $font, "image");
|
||||
echo '(' . $bbox[0] . ', ' . $bbox[1] . ")\n";
|
||||
echo '(' . $bbox[2] . ', ' . $bbox[3] . ")\n";
|
||||
echo '(' . $bbox[4] . ', ' . $bbox[5] . ")\n";
|
||||
echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(155, 15)
|
||||
(155, -48)
|
||||
(-1, -48)
|
||||
+21
-2
@@ -385,6 +385,23 @@ static int _get_lderrno(LDAP *ldap)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _set_lderrno
|
||||
*/
|
||||
static void _set_lderrno(LDAP *ldap, int lderr)
|
||||
{
|
||||
#if !HAVE_NSLDAP
|
||||
#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP
|
||||
/* New versions of OpenLDAP do it this way */
|
||||
ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
|
||||
#else
|
||||
ldap->ld_errno = lderr;
|
||||
#endif
|
||||
#else
|
||||
ldap_set_lderrno(ldap, lderr, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
|
||||
Bind to LDAP directory */
|
||||
PHP_FUNCTION(ldap_bind)
|
||||
@@ -399,18 +416,20 @@ PHP_FUNCTION(ldap_bind)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
|
||||
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
|
||||
_set_lderrno(ld->link, LDAP_INVALID_CREDENTIALS);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
|
||||
|
||||
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to bind to server: %s", ldap_err2string(rc));
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -171,7 +171,6 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init
|
||||
return retry;
|
||||
}
|
||||
|
||||
|
||||
static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
|
||||
@@ -204,59 +203,13 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
|
||||
return didwrite;
|
||||
}
|
||||
|
||||
static void php_openssl_stream_wait_for_data(php_netstream_data_t *sock)
|
||||
{
|
||||
int retval;
|
||||
struct timeval *ptimeout;
|
||||
|
||||
if (sock->socket == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
sock->timeout_event = 0;
|
||||
|
||||
if (sock->timeout.tv_sec == -1)
|
||||
ptimeout = NULL;
|
||||
else
|
||||
ptimeout = &sock->timeout;
|
||||
|
||||
while(1) {
|
||||
retval = php_pollfd_for(sock->socket, PHP_POLLREADABLE, ptimeout);
|
||||
|
||||
if (retval == 0)
|
||||
sock->timeout_event = 1;
|
||||
|
||||
if (retval >= 0)
|
||||
break;
|
||||
|
||||
if (php_socket_errno() != EINTR)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
|
||||
php_netstream_data_t *sock;
|
||||
int nr_bytes = 0;
|
||||
|
||||
if (sslsock->ssl_active) {
|
||||
int retry = 1;
|
||||
sock = (php_netstream_data_t*)stream->abstract;
|
||||
|
||||
/* The SSL_read() function will block indefinitely waiting for data on a blocking
|
||||
socket. If we don't poll for readability first this operation has the potential
|
||||
to hang forever. To avoid this scenario we poll with a timeout before performing
|
||||
the actual read. If it times out we're finished.
|
||||
*/
|
||||
if (sock->is_blocked && SSL_pending(sslsock->ssl_handle) == 0) {
|
||||
php_openssl_stream_wait_for_data(sock);
|
||||
if (sock->timeout_event) {
|
||||
stream->eof = 1;
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL read operation timed out");
|
||||
return nr_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
|
||||
@@ -881,21 +834,6 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
|
||||
|
||||
case PHP_STREAM_AS_FD_FOR_SELECT:
|
||||
if (ret) {
|
||||
/* OpenSSL has an internal buffer which select() cannot see. If we don't
|
||||
* fetch it into the stream's buffer, no activity will be reported on the
|
||||
* stream even though there is data waiting to be read - but we only fetch
|
||||
* the lower of bytes OpenSSL has ready to give us or chunk_size since we
|
||||
* weren't asked for any data at this stage. This is only likely to cause
|
||||
* issues with non-blocking streams, but it's harmless to always do it. */
|
||||
size_t pending;
|
||||
if (stream->writepos == stream->readpos
|
||||
&& sslsock->ssl_active
|
||||
&& (pending = (size_t)SSL_pending(sslsock->ssl_handle)) > 0) {
|
||||
php_stream_fill_read_buffer(stream, pending < stream->chunk_size
|
||||
? pending
|
||||
: stream->chunk_size);
|
||||
}
|
||||
|
||||
*(php_socket_t *)ret = sslsock->s.socket;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1007,9 +1007,12 @@ static int _extension_class_string(zend_class_entry **pce TSRMLS_DC, int num_arg
|
||||
int *num_classes = va_arg(args, int*);
|
||||
|
||||
if (((*pce)->type == ZEND_INTERNAL_CLASS) && (*pce)->info.internal.module && !strcasecmp((*pce)->info.internal.module->name, module->name)) {
|
||||
string_printf(str, "\n");
|
||||
_class_string(str, *pce, NULL, indent TSRMLS_CC);
|
||||
(*num_classes)++;
|
||||
/* dump class if it is not an alias */
|
||||
if (!zend_binary_strcasecmp((*pce)->name, (*pce)->name_length, hash_key->arKey, hash_key->nKeyLength-1)) {
|
||||
string_printf(str, "\n");
|
||||
_class_string(str, *pce, NULL, indent TSRMLS_CC);
|
||||
(*num_classes)++;
|
||||
}
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
@@ -5360,12 +5363,24 @@ static int add_extension_class(zend_class_entry **pce TSRMLS_DC, int num_args, v
|
||||
int add_reflection_class = va_arg(args, int);
|
||||
|
||||
if (((*pce)->type == ZEND_INTERNAL_CLASS) && (*pce)->info.internal.module && !strcasecmp((*pce)->info.internal.module->name, module->name)) {
|
||||
const char *name;
|
||||
int nlen;
|
||||
|
||||
if (zend_binary_strcasecmp((*pce)->name, (*pce)->name_length, hash_key->arKey, hash_key->nKeyLength-1)) {
|
||||
/* This is an class alias, use alias name */
|
||||
name = hash_key->arKey;
|
||||
nlen = hash_key->nKeyLength-1;
|
||||
} else {
|
||||
/* Use class name */
|
||||
name = (*pce)->name;
|
||||
nlen = (*pce)->name_length;
|
||||
}
|
||||
if (add_reflection_class) {
|
||||
ALLOC_ZVAL(zclass);
|
||||
zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
|
||||
add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
|
||||
add_assoc_zval_ex(class_array, name, nlen+1, zclass);
|
||||
} else {
|
||||
add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1);
|
||||
add_next_index_stringl(class_array, name, nlen, 1);
|
||||
}
|
||||
}
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
|
||||
@@ -365,8 +365,8 @@ static unsigned short php_read2(php_stream * stream TSRMLS_DC)
|
||||
{
|
||||
unsigned char a[2];
|
||||
|
||||
/* just return 0 if we hit the end-of-file */
|
||||
if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;
|
||||
/* return 0 if we couldn't read enough data */
|
||||
if((php_stream_read(stream, a, sizeof(a))) < sizeof(a)) return 0;
|
||||
|
||||
return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]);
|
||||
}
|
||||
@@ -646,7 +646,7 @@ static struct gfxinfo *php_handle_jpc(php_stream * stream TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
result->channels = php_read2(stream TSRMLS_CC); /* Csiz */
|
||||
if (result->channels < 0 || result->channels > 256) {
|
||||
if (result->channels == 0 && php_stream_eof(stream) || result->channels > 256) {
|
||||
efree(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #68044 Integer overflow in unserialize() (32-bits only)
|
||||
--FILE--
|
||||
<?php
|
||||
echo unserialize('C:3:"XYZ":18446744075857035259:{}');
|
||||
?>
|
||||
===DONE==
|
||||
--EXPECTF--
|
||||
Warning: Insufficient data for unserializing - %d required, 1 present in %s/bug68044.php on line 2
|
||||
|
||||
Notice: unserialize(): Error at offset 32 of 33 bytes in %s/bug68044.php on line 2
|
||||
===DONE==
|
||||
@@ -0,0 +1,95 @@
|
||||
--TEST--
|
||||
Bug #51800 proc_open on Windows hangs forever
|
||||
--SKIPIF--
|
||||
<?php
|
||||
echo 'skip expected to fail or take too long';
|
||||
if (getenv("SKIP_SLOW_TESTS")) {
|
||||
die("skip slow test");
|
||||
}
|
||||
?>
|
||||
--XFAIL--
|
||||
pipes have to be read/written simultaneously
|
||||
--FILE--
|
||||
<?php
|
||||
/* This is the wrong way to do it. The parent will block till it has read all the STDIN.
|
||||
The smaller the pipe buffer is, the longer it will take. It might even pass at the end,
|
||||
after taking inappropriately long. Pipes have to be read simultaneously in smaller chunks,
|
||||
so then the pipe buffer is emptied more often and the child has chance to continue its
|
||||
write. The behaviour might look some better if write/read in a separate thread, however
|
||||
this is much more resource greedy and complexer to integrate into the user script. */
|
||||
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
|
||||
$php = PHP_BINARY;
|
||||
$cmd = "$php $callee";
|
||||
|
||||
$status;
|
||||
$stdout = "";
|
||||
$stderr = "";
|
||||
$pipes = array();
|
||||
|
||||
$descriptors = array(
|
||||
0 => array("pipe", "rb"), // stdin
|
||||
1 => array("pipe", "wb"), // stdout
|
||||
2 => array("pipe", "wb") // stderr
|
||||
);
|
||||
|
||||
/* create the proc file */
|
||||
$r = file_put_contents($callee, '<?php
|
||||
|
||||
$how_much = 10000;
|
||||
|
||||
$data0 = str_repeat("a", $how_much);
|
||||
$data1 = str_repeat("b", $how_much);
|
||||
fwrite(STDOUT, $data0);
|
||||
fwrite(STDERR, $data1);
|
||||
|
||||
exit(0);
|
||||
');
|
||||
|
||||
if (!$r) {
|
||||
die("couldn't create helper script '$callee'");
|
||||
}
|
||||
|
||||
$process = proc_open($cmd, $descriptors, $pipes);
|
||||
|
||||
if (is_resource($process))
|
||||
{
|
||||
fclose($pipes[0]);
|
||||
|
||||
while (!feof($pipes[1]))
|
||||
$stdout .= fread($pipes[1], 1024);
|
||||
fclose($pipes[1]);
|
||||
|
||||
while (!feof($pipes[2]))
|
||||
$stderr .= fread($pipes[2], 1024);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$status = proc_close($process);
|
||||
}
|
||||
|
||||
var_dump(array(
|
||||
"status" => $status,
|
||||
"stdout" => $stdout,
|
||||
"stderr" => $stderr,
|
||||
), strlen($stdout), strlen($stderr));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800.php";
|
||||
unlink($callee);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
["status"]=>
|
||||
int(0)
|
||||
["stdout"]=>
|
||||
string(10000) "a%s"
|
||||
["stderr"]=>
|
||||
string(10000) "b%s"
|
||||
}
|
||||
int(10000)
|
||||
int(10000)
|
||||
===DONE===
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
--TEST--
|
||||
Bug #51800 proc_open on Windows hangs forever, the right way to do it
|
||||
--FILE--
|
||||
<?php
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
|
||||
$php = PHP_BINARY;
|
||||
$cmd = "$php $callee";
|
||||
|
||||
$status;
|
||||
$stdout = "";
|
||||
$stderr = "";
|
||||
$pipes = array();
|
||||
|
||||
$descriptors = array(
|
||||
0 => array("pipe", "rb"), // stdin
|
||||
1 => array("pipe", "wb"), // stdout
|
||||
2 => array("pipe", "wb") // stderr
|
||||
);
|
||||
|
||||
/* create the proc file */
|
||||
$r = file_put_contents($callee, '<?php
|
||||
|
||||
$how_much = 10000;
|
||||
|
||||
$data0 = str_repeat("a", $how_much);
|
||||
$data1 = str_repeat("b", $how_much);
|
||||
fwrite(STDOUT, $data0);
|
||||
fwrite(STDERR, $data1);
|
||||
|
||||
exit(0);
|
||||
');
|
||||
|
||||
if (!$r) {
|
||||
die("couldn't create helper script '$callee'");
|
||||
}
|
||||
|
||||
$process = proc_open($cmd, $descriptors, $pipes);
|
||||
|
||||
if (is_resource($process))
|
||||
{
|
||||
fclose($pipes[0]);
|
||||
|
||||
while (!feof($pipes[1]) || !feof($pipes[2])) {
|
||||
$stdout .= fread($pipes[1], 1024);
|
||||
$stderr .= fread($pipes[2], 1024);
|
||||
}
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$status = proc_close($process);
|
||||
}
|
||||
|
||||
var_dump(array(
|
||||
"status" => $status,
|
||||
"stdout" => $stdout,
|
||||
"stderr" => $stderr,
|
||||
), strlen($stdout), strlen($stderr));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right.php";
|
||||
unlink($callee);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
["status"]=>
|
||||
int(0)
|
||||
["stdout"]=>
|
||||
string(10000) "a%s"
|
||||
["stderr"]=>
|
||||
string(10000) "b%s"
|
||||
}
|
||||
int(10000)
|
||||
int(10000)
|
||||
===DONE===
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
--TEST--
|
||||
Bug #51800 proc_open on Windows hangs forever, the right way to do it with more data
|
||||
--FILE--
|
||||
<?php
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
|
||||
$php = PHP_BINARY;
|
||||
$cmd = "$php $callee";
|
||||
|
||||
$status;
|
||||
$stdout = "";
|
||||
$stderr = "";
|
||||
$pipes = array();
|
||||
|
||||
$descriptors = array(
|
||||
0 => array("pipe", "rb"), // stdin
|
||||
1 => array("pipe", "wb"), // stdout
|
||||
2 => array("pipe", "wb") // stderr
|
||||
);
|
||||
|
||||
/* create the proc file */
|
||||
$r = file_put_contents($callee, '<?php
|
||||
$how_much = 1000000;
|
||||
|
||||
$data0 = str_repeat("a", $how_much);
|
||||
$data1 = str_repeat("b", $how_much);
|
||||
$i0 = $i1 = 0;
|
||||
$step = 1024;
|
||||
|
||||
while ($i0 < strlen($data0) && $i1 < strlen($data1)) {
|
||||
fwrite(STDOUT, substr($data0, $i0, $step));
|
||||
fwrite(STDERR, substr($data1, $i1, $step));
|
||||
$i0 += $step;
|
||||
$i1 += $step;
|
||||
}
|
||||
|
||||
exit(0);
|
||||
');
|
||||
|
||||
if (!$r) {
|
||||
die("couldn't create helper script '$callee'");
|
||||
}
|
||||
|
||||
$process = proc_open($cmd, $descriptors, $pipes);
|
||||
|
||||
if (is_resource($process))
|
||||
{
|
||||
fclose($pipes[0]);
|
||||
|
||||
while (!feof($pipes[1]) || !feof($pipes[2])) {
|
||||
$stdout .= fread($pipes[1], 1024);
|
||||
$stderr .= fread($pipes[2], 1024);
|
||||
}
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$status = proc_close($process);
|
||||
}
|
||||
|
||||
var_dump(array(
|
||||
"status" => $status,
|
||||
"stdout" => $stdout,
|
||||
"stderr" => $stderr,
|
||||
), strlen($stdout), strlen($stderr));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$callee = dirname(__FILE__) . "/process_proc_open_bug51800_right2.php";
|
||||
unlink($callee);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
["status"]=>
|
||||
int(0)
|
||||
["stdout"]=>
|
||||
string(1000000) "a%s"
|
||||
["stderr"]=>
|
||||
string(1000000) "b%s"
|
||||
}
|
||||
int(1000000)
|
||||
int(1000000)
|
||||
===DONE===
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
Bug #60120 proc_open hangs with stdin/out with 2048+ bytes
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
|
||||
} else {
|
||||
$cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
|
||||
}
|
||||
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
|
||||
$stdin = str_repeat('*', 1024 * 16) . '!';
|
||||
$stdin = str_repeat('*', 2049 );
|
||||
|
||||
$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
|
||||
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
|
||||
|
||||
foreach ($pipes as $pipe) {
|
||||
stream_set_blocking($pipe, false);
|
||||
}
|
||||
$writePipes = array($pipes[0]);
|
||||
$stdinLen = strlen($stdin);
|
||||
$stdinOffset = 0;
|
||||
|
||||
unset($pipes[0]);
|
||||
|
||||
while ($pipes || $writePipes) {
|
||||
$r = $pipes;
|
||||
$w = $writePipes;
|
||||
$e = null;
|
||||
$n = stream_select($r, $w, $e, 60);
|
||||
|
||||
if (false === $n) {
|
||||
break;
|
||||
} elseif ($n === 0) {
|
||||
proc_terminate($process);
|
||||
|
||||
}
|
||||
if ($w) {
|
||||
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
|
||||
if (false !== $written) {
|
||||
$stdinOffset += $written;
|
||||
}
|
||||
if ($stdinOffset >= $stdinLen) {
|
||||
fclose($writePipes[0]);
|
||||
$writePipes = null;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($r as $pipe) {
|
||||
$type = array_search($pipe, $pipes);
|
||||
$data = fread($pipe, 8192);
|
||||
var_dump($data);
|
||||
if (false === $data || feof($pipe)) {
|
||||
fclose($pipe);
|
||||
unset($pipes[$type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(2049) "%s"
|
||||
string(2049) "%s"
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
===DONE===
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
--TEST--
|
||||
Bug #64438 proc_open hangs with stdin/out with 4097+ bytes
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
$cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
|
||||
} else {
|
||||
$cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
|
||||
}
|
||||
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
|
||||
$stdin = str_repeat('*', 4097);
|
||||
|
||||
$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
|
||||
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
|
||||
|
||||
foreach ($pipes as $pipe) {
|
||||
stream_set_blocking($pipe, false);
|
||||
}
|
||||
$writePipes = array($pipes[0]);
|
||||
$stdinLen = strlen($stdin);
|
||||
$stdinOffset = 0;
|
||||
|
||||
unset($pipes[0]);
|
||||
|
||||
while ($pipes || $writePipes) {
|
||||
$r = $pipes;
|
||||
$w = $writePipes;
|
||||
$e = null;
|
||||
$n = stream_select($r, $w, $e, 60);
|
||||
|
||||
if (false === $n) {
|
||||
break;
|
||||
} elseif ($n === 0) {
|
||||
proc_terminate($process);
|
||||
|
||||
}
|
||||
if ($w) {
|
||||
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
|
||||
if (false !== $written) {
|
||||
$stdinOffset += $written;
|
||||
}
|
||||
if ($stdinOffset >= $stdinLen) {
|
||||
fclose($writePipes[0]);
|
||||
$writePipes = null;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($r as $pipe) {
|
||||
$type = array_search($pipe, $pipes);
|
||||
$data = fread($pipe, 8192);
|
||||
var_dump($data);
|
||||
if (false === $data || feof($pipe)) {
|
||||
fclose($pipe);
|
||||
unset($pipes[$type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(4097) "%s"
|
||||
string(4097) "%s"
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
===DONE===
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Sat Jun 21 21:27:56 2014 */
|
||||
/* Generated by re2c 0.13.5 */
|
||||
#line 1 "ext/standard/var_unserializer.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -372,7 +372,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
|
||||
(*p) += 2;
|
||||
|
||||
if (datalen < 0 || (*p) + datalen >= max) {
|
||||
if (datalen < 0 || (max - (*p)) <= datalen) {
|
||||
zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
|
||||
|
||||
(*p) += 2;
|
||||
|
||||
if (datalen < 0 || (*p) + datalen >= max) {
|
||||
if (datalen < 0 || (max - (*p)) <= datalen) {
|
||||
zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -219,16 +219,19 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
|
||||
n = 10;
|
||||
tm.tm_mon = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
XMLRPC_IS_NUMBER(text[i])
|
||||
XMLRPC_IS_NUMBER(text[i+4])
|
||||
tm.tm_mon += (text[i+4]-'0')*n;
|
||||
n /= 10;
|
||||
}
|
||||
tm.tm_mon --;
|
||||
if(tm.tm_mon < 0 || tm.tm_mon > 11) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
n = 10;
|
||||
tm.tm_mday = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
XMLRPC_IS_NUMBER(text[i])
|
||||
XMLRPC_IS_NUMBER(text[i+6])
|
||||
tm.tm_mday += (text[i+6]-'0')*n;
|
||||
n /= 10;
|
||||
}
|
||||
@@ -236,7 +239,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
|
||||
n = 10;
|
||||
tm.tm_hour = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
XMLRPC_IS_NUMBER(text[i])
|
||||
XMLRPC_IS_NUMBER(text[i+9])
|
||||
tm.tm_hour += (text[i+9]-'0')*n;
|
||||
n /= 10;
|
||||
}
|
||||
@@ -244,7 +247,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
|
||||
n = 10;
|
||||
tm.tm_min = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
XMLRPC_IS_NUMBER(text[i])
|
||||
XMLRPC_IS_NUMBER(text[i+12])
|
||||
tm.tm_min += (text[i+12]-'0')*n;
|
||||
n /= 10;
|
||||
}
|
||||
@@ -252,7 +255,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
|
||||
n = 10;
|
||||
tm.tm_sec = 0;
|
||||
for(i = 0; i < 2; i++) {
|
||||
XMLRPC_IS_NUMBER(text[i])
|
||||
XMLRPC_IS_NUMBER(text[i+15])
|
||||
tm.tm_sec += (text[i+15]-'0')*n;
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Bug #68027 (buffer overflow in mkgmtime() function)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("xmlrpc")) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$d = '6-01-01 20:00:00';
|
||||
xmlrpc_set_type($d, 'datetime');
|
||||
var_dump($d);
|
||||
$datetime = "2001-0-08T21:46:40-0400";
|
||||
$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
|
||||
print_r($obj);
|
||||
|
||||
$datetime = "34770-0-08T21:46:40-0400";
|
||||
$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
|
||||
print_r($obj);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(stdClass)#1 (3) {
|
||||
["scalar"]=>
|
||||
string(16) "6-01-01 20:00:00"
|
||||
["xmlrpc_type"]=>
|
||||
string(8) "datetime"
|
||||
["timestamp"]=>
|
||||
int(%d)
|
||||
}
|
||||
stdClass Object
|
||||
(
|
||||
[scalar] => 2001-0-08T21:46:40-0400
|
||||
[xmlrpc_type] => datetime
|
||||
[timestamp] => %s
|
||||
)
|
||||
stdClass Object
|
||||
(
|
||||
[scalar] => 34770-0-08T21:46:40-0400
|
||||
[xmlrpc_type] => datetime
|
||||
[timestamp] => %d
|
||||
)
|
||||
Done
|
||||
@@ -297,9 +297,6 @@ PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t coun
|
||||
#define php_stream_write_string(stream, str) _php_stream_write(stream, str, strlen(str) TSRMLS_CC)
|
||||
#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC)
|
||||
|
||||
PHPAPI void _php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_DC);
|
||||
#define php_stream_fill_read_buffer(stream, size) _php_stream_fill_read_buffer((stream), (size) TSRMLS_CC)
|
||||
|
||||
#ifdef ZTS
|
||||
PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
|
||||
#else
|
||||
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 5
|
||||
#define PHP_RELEASE_VERSION 18
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.5.18-dev"
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.5.18"
|
||||
#define PHP_VERSION_ID 50518
|
||||
@@ -348,6 +348,34 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
|
||||
assert(data != NULL);
|
||||
|
||||
if (data->fd >= 0) {
|
||||
#ifdef PHP_WIN32
|
||||
php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
|
||||
|
||||
if (self->is_pipe || self->is_process_pipe) {
|
||||
HANDLE ph = (HANDLE)_get_osfhandle(data->fd);
|
||||
int retry = 0;
|
||||
DWORD avail_read = 0;
|
||||
|
||||
do {
|
||||
/* Look ahead to get the available data amount to read. Do the same
|
||||
as read() does, however not blocking forever. In case it failed,
|
||||
no data will be read (better than block). */
|
||||
if (!PeekNamedPipe(ph, NULL, 0, NULL, &avail_read, NULL)) {
|
||||
break;
|
||||
}
|
||||
/* If there's nothing to read, wait in 100ms periods. */
|
||||
if (0 == avail_read) {
|
||||
usleep(100000);
|
||||
}
|
||||
} while (0 == avail_read && retry++ < 320);
|
||||
|
||||
/* Reduce the required data amount to what is available, otherwise read()
|
||||
will block.*/
|
||||
if (avail_read < count) {
|
||||
count = avail_read;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ret = read(data->fd, buf, count);
|
||||
|
||||
if (ret == (size_t)-1 && errno == EINTR) {
|
||||
|
||||
@@ -568,7 +568,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
|
||||
|
||||
/* {{{ generic stream operations */
|
||||
|
||||
PHPAPI void _php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_DC)
|
||||
static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_DC)
|
||||
{
|
||||
/* allocate/fill the buffer */
|
||||
|
||||
@@ -736,7 +736,7 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size TSRMLS
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
php_stream_fill_read_buffer(stream, size);
|
||||
php_stream_fill_read_buffer(stream, size TSRMLS_CC);
|
||||
|
||||
toread = stream->writepos - stream->readpos;
|
||||
if (toread > size) {
|
||||
@@ -972,7 +972,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen,
|
||||
}
|
||||
}
|
||||
|
||||
php_stream_fill_read_buffer(stream, toread);
|
||||
php_stream_fill_read_buffer(stream, toread TSRMLS_CC);
|
||||
|
||||
if (stream->writepos - stream->readpos == 0) {
|
||||
break;
|
||||
@@ -1047,7 +1047,7 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
|
||||
|
||||
to_read_now = MIN(maxlen - buffered_len, stream->chunk_size);
|
||||
|
||||
php_stream_fill_read_buffer(stream, buffered_len + to_read_now);
|
||||
php_stream_fill_read_buffer(stream, buffered_len + to_read_now TSRMLS_CC);
|
||||
|
||||
just_read = STREAM_BUFFERED_AMOUNT(stream) - buffered_len;
|
||||
|
||||
|
||||
+2
-2
@@ -1112,7 +1112,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy)
|
||||
|
||||
shutdown(req->fd, 1);
|
||||
/* read the last FCGI_STDIN header (it may be omitted) */
|
||||
recv(req->fd, &buf, sizeof(buf), 0);
|
||||
recv(req->fd, (char *)(&buf), sizeof(buf), 0);
|
||||
}
|
||||
closesocket(req->fd);
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ static inline void fcgi_close(fcgi_request *req, int force, int destroy)
|
||||
|
||||
shutdown(req->fd, 1);
|
||||
/* read the last FCGI_STDIN header (it may be omitted) */
|
||||
recv(req->fd, &buf, sizeof(buf), 0);
|
||||
recv(req->fd, (char *)(&buf), sizeof(buf), 0);
|
||||
}
|
||||
close(req->fd);
|
||||
#endif
|
||||
|
||||
@@ -59,8 +59,6 @@ foreach ($codes as $key => $code) {
|
||||
|
||||
echo "\nDone\n";
|
||||
?>
|
||||
--XFAIL--
|
||||
https://bugs.php.net/bug.php?id=55496
|
||||
--EXPECTF--
|
||||
--------------
|
||||
Snippet no. 1:
|
||||
|
||||
@@ -1231,6 +1231,17 @@ static void init_request_info(TSRMLS_D)
|
||||
SG(request_info).request_uri = orig_script_name;
|
||||
}
|
||||
path_info[0] = old;
|
||||
} else if (apache_was_here && env_script_name) {
|
||||
/* Using mod_proxy_fcgi and ProxyPass, apache cannot set PATH_INFO
|
||||
* As we can extract PATH_INFO from PATH_TRANSLATED
|
||||
* it is probably also in SCRIPT_NAME and need to be removed
|
||||
*/
|
||||
int snlen = strlen(env_script_name);
|
||||
if (snlen>slen && !strcmp(env_script_name+snlen-slen, path_info)) {
|
||||
_sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);
|
||||
env_script_name[snlen-slen] = 0;
|
||||
SG(request_info).request_uri = _sapi_cgibin_putenv("SCRIPT_NAME", env_script_name TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
env_path_info = _sapi_cgibin_putenv("PATH_INFO", path_info TSRMLS_CC);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user