Merge branch 'PHP-5.6.18' into PHP-7.0.3

* PHP-5.6.18:
  fix tests
  fix NEWS
  Update NEWS
  update NEWS
  Fixed bug #71488: Stack overflow when decompressing tar archives
  update NEWS
  add missing headers for SIZE_MAX
  backport the escapeshell* functions hardening branch
  add tests
  Fix bug #71459 - Integer overflow in iptcembed()
  prepare 5.6.18RC1
  Fix test when run with openssl < 1.0.2 (reorder so no more SSLv2 message) Fix skip message to work
  improve fix for bug #71201
  Fixed bug #71323 - Output of stream_get_meta_data can be falsified by its input
  Fix bug #71391: NULL Pointer Dereference in phar_tar_setupmetadata()
  Fixed bug #71331 - Uninitialized pointer in phar_make_dirstream()
  Fix bug #71335: Type Confusion in WDDX Packet Deserialization
  Fix bug #71354 - remove UMR when size is 0

Conflicts:
	configure.in
	ext/phar/dirstream.c
	ext/phar/phar_object.c
	ext/phar/tar.c
	ext/standard/exec.c
	ext/standard/iptc.c
	ext/standard/math.c
	ext/standard/streamsfuncs.c
	ext/wddx/wddx.c
	main/php_version.h
	main/streams/memory.c
This commit is contained in:
Stanislav Malyshev 2016-02-01 19:55:09 -08:00
commit e231830f16
33 changed files with 431 additions and 281 deletions

View file

@ -199,13 +199,14 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest) /* {{{ */
zend_hash_internal_pointer_reset(manifest);
while (FAILURE != zend_hash_has_more_elements(manifest)) {
keylen = 0;
if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key(manifest, &str_key, &unused)) {
break;
}
keylen = ZSTR_LEN(str_key);
if (keylen <= (uint)dirlen) {
if (keylen < (uint)dirlen || !strncmp(ZSTR_VAL(str_key), dir, dirlen)) {
if (keylen == 0 || keylen < (uint)dirlen || !strncmp(ZSTR_VAL(str_key), dir, dirlen)) {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}

View file

@ -195,6 +195,13 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp) /*
}
/* }}} */
#if !HAVE_STRNLEN
static size_t strnlen(const char *s, size_t maxlen) {
char *r = (char *)memchr(s, '\0', maxlen);
return r ? r-s : maxlen;
}
#endif
int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error) /* {{{ */
{
char buf[512], *actual_alias = NULL, *p;
@ -204,6 +211,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
php_uint32 sum1, sum2, size, old;
phar_archive_data *myphar, *actual;
int last_was_longlink = 0;
int linkname_len;
if (error) {
*error = NULL;
@ -264,7 +272,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
goto next;
}
if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
if (((!old && hdr->prefix[0] == 0) || old) && strnlen(hdr->name, 100) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
zend_off_t curloc;
if (size > 511) {
@ -348,7 +356,7 @@ bail:
entry.filename_len = entry.uncompressed_filesize;
/* Check for overflow - bug 61065 */
if (entry.filename_len == UINT_MAX) {
if (entry.filename_len == UINT_MAX || entry.filename_len == 0) {
if (error) {
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (invalid entry size)", fname);
}
@ -472,20 +480,22 @@ bail:
}
entry.link = NULL;
/* link field is null-terminated unless it has 100 non-null chars.
* Thus we can not use strlen. */
linkname_len = strnlen(hdr->linkname, 100);
if (entry.tar_type == TAR_LINK) {
if (!zend_hash_str_exists(&myphar->manifest, hdr->linkname, strlen(hdr->linkname))) {
if (!zend_hash_str_exists(&myphar->manifest, hdr->linkname, linkname_len)) {
if (error) {
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file - hard link to non-existent file \"%s\"", fname, hdr->linkname);
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file - hard link to non-existent file \"%.*s\"", fname, linkname_len, hdr->linkname);
}
pefree(entry.filename, entry.is_persistent);
php_stream_close(fp);
phar_destroy_phar_data(myphar);
return FAILURE;
}
entry.link = estrdup(hdr->linkname);
entry.link = estrndup(hdr->linkname, linkname_len);
} else if (entry.tar_type == TAR_SYMLINK) {
entry.link = estrdup(hdr->linkname);
entry.link = estrndup(hdr->linkname, linkname_len);
}
phar_set_inode(&entry);
if ((newentry = zend_hash_str_add_mem(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) == NULL) {

View file

@ -0,0 +1,15 @@
--TEST--
Bug #71331 (Uninitialized pointer in phar_make_dirstream())
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$p = new PharData(__DIR__."/bug71331.tar");
?>
DONE
--EXPECTF--
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'phar error: "%s/bug71331.tar" is a corrupted tar file (invalid entry size)' in %s/bug71331.php:2
Stack trace:
#0 %s/bug71331.php(2): PharData->__construct('%s')
#1 {main}
thrown in %s/bug71331.php on line 2

BIN
ext/phar/tests/bug71331.tar Normal file

Binary file not shown.

View file

@ -0,0 +1,13 @@
--TEST--
Phar: bug #71354: Heap corruption in tar/zip/phar parser.
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$p = new PharData(__DIR__."/bug71354.tar");
var_dump($p['aaaa']->getContent());
?>
DONE
--EXPECT--
string(0) ""
DONE

BIN
ext/phar/tests/bug71354.tar Normal file

Binary file not shown.

View file

@ -0,0 +1,18 @@
--TEST--
Phar: bug #71391: NULL Pointer Dereference in phar_tar_setupmetadata()
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
// duplicate since the tar will change
copy(__DIR__."/bug71391.tar", __DIR__."/bug71391.test.tar");
$p = new PharData(__DIR__."/bug71391.test.tar");
$p->delMetaData();
?>
DONE
--CLEAN--
<?php
unlink(__DIR__."/bug71391.test.tar");
?>
--EXPECT--
DONE

BIN
ext/phar/tests/bug71391.tar Normal file

Binary file not shown.

View file

@ -0,0 +1,16 @@
--TEST--
Phar: bug #71488: Stack overflow when decompressing tar archives
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$p = new PharData(__DIR__."/bug71488.tar");
$newp = $p->decompress("test");
?>
DONE
--CLEAN--
<?php
@unlink(__DIR__."/bug71488.test");
?>
--EXPECT--
DONE

BIN
ext/phar/tests/bug71488.tar Normal file

Binary file not shown.

View file

@ -38,6 +38,15 @@
#include <sys/stat.h>
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
#else
# if HAVE_INTTYPES_H
# include <inttypes.h>
# elif HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
/* some defines for the different JPEG block types */
#define M_SOF0 0xC0 /* Start Of Frame N */

View file

@ -507,6 +507,12 @@ PHP_FUNCTION(stream_get_meta_data)
array_init(return_value);
if (!php_stream_populate_meta_data(stream, return_value)) {
add_assoc_bool(return_value, "timed_out", 0);
add_assoc_bool(return_value, "blocked", 1);
add_assoc_bool(return_value, "eof", php_stream_eof(stream));
}
if (!Z_ISUNDEF(stream->wrapperdata)) {
Z_ADDREF_P(&stream->wrapperdata);
add_assoc_zval(return_value, "wrapper_data", &stream->wrapperdata);
@ -540,11 +546,6 @@ PHP_FUNCTION(stream_get_meta_data)
add_assoc_string(return_value, "uri", stream->orig_path);
}
if (!php_stream_populate_meta_data(stream, return_value)) {
add_assoc_bool(return_value, "timed_out", 0);
add_assoc_bool(return_value, "blocked", 1);
add_assoc_bool(return_value, "eof", php_stream_eof(stream));
}
}
/* }}} */

View file

@ -34,6 +34,8 @@ foreach($streams as $stream)
<?php exit(0); ?>
--EXPECTF--
array(7) {
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -46,8 +48,6 @@ array(7) {
bool(true)
["uri"]=>
string(8) "data://,"
["base64"]=>
bool(false)
}
NULL
@ -55,6 +55,8 @@ Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sst
NULL
NULL
array(7) {
["base64"]=>
bool(true)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -67,8 +69,6 @@ array(7) {
bool(true)
["uri"]=>
string(15) "data://;base64,"
["base64"]=>
bool(true)
}
NULL
@ -84,6 +84,10 @@ Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media t
NULL
NULL
array(8) {
["mediatype"]=>
string(10) "text/plain"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -96,10 +100,6 @@ array(8) {
bool(true)
["uri"]=>
string(18) "data://text/plain,"
["mediatype"]=>
string(10) "text/plain"
["base64"]=>
bool(false)
}
NULL
@ -107,6 +107,12 @@ Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal
NULL
NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -119,12 +125,6 @@ array(9) {
bool(true)
["uri"]=>
string(26) "data://text/plain;foo=bar,"
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(false)
}
string(3) "bar"
@ -132,6 +132,12 @@ Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397:
NULL
NULL
array(9) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(true)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -144,12 +150,6 @@ array(9) {
bool(true)
["uri"]=>
string(33) "data://text/plain;foo=bar;base64,"
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["base64"]=>
bool(true)
}
string(3) "bar"
@ -157,6 +157,14 @@ Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc239
NULL
NULL
array(10) {
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["bar"]=>
string(3) "baz"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
@ -169,14 +177,6 @@ array(10) {
bool(true)
["uri"]=>
string(34) "data://text/plain;foo=bar;bar=baz,"
["mediatype"]=>
string(10) "text/plain"
["foo"]=>
string(3) "bar"
["bar"]=>
string(3) "baz"
["base64"]=>
bool(false)
}
string(3) "bar"
===DONE===

View file

@ -18,6 +18,12 @@ fclose($server);
?>
--EXPECTF--
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socket%S"
["mode"]=>
@ -26,10 +32,4 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -0,0 +1,31 @@
--TEST--
Bug #71323: Output of stream_get_meta_data can be falsified by its input
--FILE--
<?php
$file = 'data:text/plain;z=y;uri=eviluri;mediatype=wut?;mediatype2=hello,somedata';
$meta = stream_get_meta_data(fopen($file, "r"));
var_dump($meta);
?>
--EXPECTF--
array(10) {
["mediatype"]=>
string(10) "text/plain"
["z"]=>
string(1) "y"
["uri"]=>
string(72) "data:text/plain;z=y;uri=eviluri;mediatype=wut?;mediatype2=hello,somedata"
["mediatype2"]=>
string(5) "hello"
["base64"]=>
bool(false)
["wrapper_type"]=>
string(7) "RFC2397"
["stream_type"]=>
string(7) "RFC2397"
["mode"]=>
string(1) "r"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(true)
}

View file

@ -13,6 +13,12 @@ var_dump(stream_get_meta_data($dirObject->handle));
?>
--EXPECT--
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -23,14 +29,14 @@ array(8) {
int(0)
["seekable"]=>
bool(true)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -41,10 +47,4 @@ array(8) {
int(0)
["seekable"]=>
bool(true)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -12,6 +12,12 @@ fclose($fp);
?>
--EXPECTF--
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -24,10 +30,4 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%sstream_get_meta_data_file_basic.php"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -29,6 +29,12 @@ unlink($filename);
?>
--EXPECTF--
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -41,14 +47,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -61,14 +67,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -81,14 +87,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -101,14 +107,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -121,14 +127,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -141,14 +147,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -161,14 +167,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -181,14 +187,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -201,14 +207,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -221,14 +227,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -241,14 +247,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -261,14 +267,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -281,14 +287,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -301,14 +307,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -321,14 +327,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -341,14 +347,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -361,14 +367,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -381,14 +387,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -401,14 +407,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -421,14 +427,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -441,14 +447,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -461,14 +467,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -481,14 +487,14 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -501,10 +507,4 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -43,6 +43,12 @@ unlink($filename);
--EXPECTF--
Write some data to the file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -55,12 +61,6 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
@ -68,6 +68,12 @@ Read a line of the file, causing data to be buffered:
string(15) "a line of data
"
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -80,17 +86,17 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
}
Read 20 bytes from the file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read 20 bytes from the file:
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -103,17 +109,17 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read entire file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -126,10 +132,4 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s.tmp"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
}

View file

@ -28,6 +28,12 @@ unlink($filename);
--EXPECTF--
Create a file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -40,16 +46,16 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp"
}
Change to file's directory and open with a relative path:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Change to file's directory and open with a relative path:
array(9) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -62,10 +68,4 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "stream_get_meta_data_file_variation4.php.tmp"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -33,6 +33,12 @@ unlink($filename);
--EXPECTF--
Write some data to the file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -45,17 +51,17 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read entire file:
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
@ -68,10 +74,4 @@ array(9) {
bool(true)
["uri"]=>
string(%i) "%s"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
}

View file

@ -18,6 +18,12 @@ echo "Done";
?>
--EXPECT--
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(5) "STDIO"
["mode"]=>
@ -26,11 +32,5 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Done

View file

@ -10,6 +10,12 @@ fclose($tcp_socket);
?>
--EXPECTF--
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -18,10 +24,4 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -39,6 +39,12 @@ var_dump(stream_get_meta_data($client));
--EXPECTF--
Write some data:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -47,17 +53,17 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
}
Read a line from the client, causing data to be buffered:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read a line from the client, causing data to be buffered:
array(7) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -66,17 +72,17 @@ array(7) {
int(15)
["seekable"]=>
bool(false)
}
Read 3 bytes of data from the client:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read 3 bytes of data from the client:
array(7) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -85,17 +91,17 @@ array(7) {
int(12)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Close the server side socket and read the remaining data from the client:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -104,10 +110,4 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
}

View file

@ -37,6 +37,12 @@ fclose($server);
?>
--EXPECTF--
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -45,17 +51,17 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Set a timeout on the client and attempt a read:
array(7) {
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -64,17 +70,17 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Write some data from the server:
array(7) {
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -83,17 +89,17 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read some data from the client:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -102,10 +108,4 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -32,6 +32,12 @@ fclose($server);
?>
--EXPECTF--
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -40,18 +46,18 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Set blocking to false:
bool(true)
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(false)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -60,18 +66,18 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(false)
["eof"]=>
bool(false)
}
Set blocking to true:
bool(true)
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -80,10 +86,4 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -37,6 +37,12 @@ fclose($client);
--EXPECTF--
Write some data:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -45,17 +51,17 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Read a line from the client:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -64,17 +70,17 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Close the server side socket and read the remaining data from the client:
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
@ -83,10 +89,4 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(true)
}

View file

@ -5,7 +5,7 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p
--SKIPIF--
<?php
if (phpversion() < "5.3.0") { die('SKIP php version so lower.'); }
if (!extension_loaded('openssl')) { die('ext/openssl required'); }
if (!extension_loaded('openssl')) { die('skip ext/openssl required'); }
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip not for windows');
}
@ -18,8 +18,8 @@ $sock = stream_socket_server($serverUri, $errno, $errstr);
if (is_resource($sock)) {
var_dump(stream_socket_enable_crypto($sock, false));
var_dump(stream_socket_enable_crypto($sock, true));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_CLIENT));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_CLIENT));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLS_CLIENT));
var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_SERVER));
@ -43,9 +43,6 @@ bool(false)
Warning: stream_socket_enable_crypto(): When enabling encryption you must specify the crypto type in %s on line %d
bool(false)
Warning: stream_socket_enable_crypto(): SSLv2 %s in %s on line %d
bool(false)
Warning: stream_socket_enable_crypto(): SSL: Broken pipe in %s on line %d
bool(false)
@ -66,3 +63,6 @@ bool(false)
Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d
bool(false)
Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d
bool(false)

View file

@ -0,0 +1,33 @@
--TEST--
Bug #71335 (Type Confusion in WDDX Packet Deserialization)
--SKIPIF--
<?php
if (!extension_loaded("wddx")) print "skip";
?>
--FILE--
<?php
$x = "<?xml version='1.0'?>
<wddxPacket version='1.0'>
<header/>
<data>
<struct>
<var name='php_class_name'>
<string>stdClass</string>
</var>
<var name='php_class_name'>
<string>stdClass</string>
</var>
</struct>
</data>
</wddxPacket>";
$d = wddx_deserialize($x);
var_dump($d);
?>
DONE
--EXPECTF--
object(stdClass)#%d (1) {
["php_class_name"]=>
string(8) "stdClass"
}
DONE

View file

@ -912,7 +912,8 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
if (ent1->varname) {
if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&
Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data) && ent2->type == ST_STRUCT) {
Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data) &&
ent2->type == ST_STRUCT && Z_TYPE(ent2->data) == IS_ARRAY) {
zend_bool incomplete_class = 0;
zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));

View file

@ -35,6 +35,12 @@ fclose($fp);
?>
--EXPECTF--
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(3) "zip"
["mode"]=>
@ -45,14 +51,14 @@ array(8) {
bool(false)
["uri"]=>
string(3) "foo"
}
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(11) "zip wrapper"
["stream_type"]=>
@ -65,10 +71,4 @@ array(9) {
bool(false)
["uri"]=>
string(%d) "zip://%stest_with_comment.zip#foo"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}

View file

@ -25,6 +25,12 @@ gzclose($h);
--EXPECTF--
no wrapper
array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
["stream_type"]=>
string(4) "ZLIB"
["mode"]=>
@ -33,16 +39,16 @@ array(7) {
int(0)
["seekable"]=>
bool(true)
}
with wrapper
array(9) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
with wrapper
array(9) {
["wrapper_type"]=>
string(4) "ZLIB"
["stream_type"]=>
@ -55,11 +61,5 @@ array(9) {
bool(true)
["uri"]=>
string(%d) "compress.zlib://%s/004.txt.gz"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
===DONE===

View file

@ -697,7 +697,9 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
plen = sep - path;
vlen = (semi ? semi - sep : mlen - plen) - 1 /* '=' */;
key = estrndup(path, plen);
if (plen != sizeof("mediatype")-1 || memcmp(key, "mediatype", sizeof("mediatype")-1)) {
add_assoc_stringl_ex(&meta, key, plen, sep + 1, vlen);
}
efree(key);
plen += vlen + 1;
mlen -= plen;