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 (stream->wrapperdata) {
MAKE_STD_ZVAL(newval);
MAKE_COPY_ZVAL(&stream->wrapperdata, newval);
add_assoc_string(return_value, "uri", stream->orig_path, 1);
}
- 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));
- }
-
}
/* }}} */
} else { /* HASH_KEY_IS_STRING */
zend_hash_update(new_hash, key, key_len, (void *)elem, sizeof(zval *), (void **)&dest_elem);
}
-
+
if (dest_elem) {
zval_add_ref(dest_elem);
}
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given %ld", csize);
RETURN_FALSE;
}
- /* stream.chunk_size is actually a size_t, but php_stream_set_option
+ /* stream.chunk_size is actually a size_t, but php_stream_set_option
* can only use an int to accept the new value and return the old one.
* In any case, values larger than INT_MAX for a chunk size make no sense.
*/
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size cannot be larger than %d", INT_MAX);
RETURN_FALSE;
}
-
+
php_stream_from_zval(stream, &zstream);
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL);
-
+
RETURN_LONG(ret > 0 ? (long)ret : (long)EOF);
}
/* }}} */
--- /dev/null
+--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)
+}
?>
--EXPECT--
array(8) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
int(0)
["seekable"]=>
bool(true)
+}
+array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
-}
-array(8) {
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
int(0)
["seekable"]=>
bool(true)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
?>
--EXPECTF--
array(9) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
bool(true)
["uri"]=>
string(%i) "%sstream_get_meta_data_file_basic.php"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
?>
--EXPECTF--
array(9) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
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"]=>
bool(true)
["uri"]=>
string(%i) "%s.tmp"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
--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"]=>
bool(true)
["uri"]=>
string(%i) "%s.tmp"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
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"]=>
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"]=>
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"]=>
bool(true)
["uri"]=>
string(%i) "%s.tmp"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(true)
}
--EXPECTF--
Create a file:
array(9) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["wrapper_type"]=>
string(9) "plainfile"
["stream_type"]=>
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"]=>
bool(true)
["uri"]=>
string(%i) "stream_get_meta_data_file_variation4.php.tmp"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
--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"]=>
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"]=>
bool(true)
["uri"]=>
string(%i) "%s"
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(true)
}
?>
--EXPECT--
array(7) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["stream_type"]=>
string(5) "STDIO"
["mode"]=>
int(0)
["seekable"]=>
bool(false)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
Done
?>
--EXPECTF--
array(7) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
int(0)
["seekable"]=>
bool(false)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
--EXPECTF--
Write some data:
array(7) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
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"]=>
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"]=>
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"]=>
int(0)
["seekable"]=>
bool(false)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(true)
}
?>
--EXPECTF--
array(7) {
- ["stream_type"]=>
- string(%d) "tcp_socke%s"
- ["mode"]=>
- string(2) "r+"
- ["unread_bytes"]=>
- 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) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
int(0)
["seekable"]=>
bool(false)
+}
+
+
+Set a timeout on the client and attempt a read:
+array(7) {
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
-}
-
-
-Write some data from the server:
-array(7) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
int(0)
["seekable"]=>
bool(false)
+}
+
+
+Write some data from the server:
+array(7) {
["timed_out"]=>
bool(true)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
-}
-
-
-Read some data from the client:
-array(7) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
int(0)
["seekable"]=>
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"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
}
?>
--EXPECTF--
array(7) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
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"]=>
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"]=>
int(0)
["seekable"]=>
bool(false)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(false)
}
--EXPECTF--
Write some data:
array(7) {
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
int(%i)
["seekable"]=>
bool(false)
+}
+
+
+Read a line from the client:
+array(7) {
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
-}
-
-
-Read a line from the client:
-array(7) {
["stream_type"]=>
string(%d) "tcp_socke%s"
["mode"]=>
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"]=>
int(%i)
["seekable"]=>
bool(false)
- ["timed_out"]=>
- bool(false)
- ["blocked"]=>
- bool(true)
- ["eof"]=>
- bool(true)
}
memset(ssb, 0, sizeof(php_stream_statbuf));
/* read-only across the board */
-
+
ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666;
ssb->sb.st_size = ms->fsize;
{
php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;
size_t newsize;
-
+
switch(option) {
case PHP_STREAM_OPTION_TRUNCATE_API:
switch (value) {
}
}
/* }}} */
-
+
PHPAPI php_stream_ops php_stream_memory_ops = {
php_stream_memory_write, php_stream_memory_read,
php_stream_memory_close, php_stream_memory_flush,
self->fsize = 0;
self->smax = ~0u;
self->mode = mode;
-
+
stream = php_stream_alloc_rel(&php_stream_memory_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
return stream;
if ((stream = php_stream_memory_create_rel(mode)) != NULL) {
ms = (php_stream_memory_data*)stream->abstract;
-
+
if (mode == TEMP_STREAM_READONLY || mode == TEMP_STREAM_TAKE_BUFFER) {
/* use the buffer directly */
ms->data = buf;
if (!ts->innerstream) {
return -1;
}
-
+
got = php_stream_read(ts->innerstream, buf, count);
-
+
stream->eof = ts->innerstream->eof;
-
+
return got;
}
/* }}} */
} else {
ret = 0;
}
-
+
if (ts->meta) {
zval_ptr_dtor(&ts->meta);
}
ret = php_stream_seek(ts->innerstream, offset, whence);
*newoffs = php_stream_tell(ts->innerstream);
stream->eof = ts->innerstream->eof;
-
+
return ret;
}
/* }}} */
file = php_stream_fopen_tmpfile();
php_stream_write(file, membuf, memsize);
pos = php_stream_tell(ts->innerstream);
-
+
php_stream_free_enclosed(ts->innerstream, PHP_STREAM_FREE_CLOSE);
ts->innerstream = file;
php_stream_encloses(stream, ts->innerstream);
static int php_stream_temp_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */
{
php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract;
-
+
switch(option) {
case PHP_STREAM_OPTION_META_DATA_API:
if (ts->meta) {
dlen -= mlen;
semi = memchr(path, ';', mlen);
sep = memchr(path, '/', mlen);
-
+
if (!semi && !sep) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "rfc2397: illegal media type");
return NULL;
plen = sep - path;
vlen = (semi ? semi - sep : mlen - plen) - 1 /* '=' */;
key = estrndup(path, plen);
- add_assoc_stringl_ex(meta, key, plen + 1, sep + 1, vlen, 1);
+ if (plen != sizeof("mediatype")-1 || memcmp(key, "mediatype", sizeof("mediatype")-1)) {
+ add_assoc_stringl_ex(meta, key, plen + 1, sep + 1, vlen, 1);
+ }
efree(key);
plen += vlen + 1;
mlen -= plen;