summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-04-20 01:18:58 +0000
committerSara Golemon <pollita@php.net>2003-04-20 01:18:58 +0000
commit7c8c09b3cfe0da00b07edf38923018aee93f5d41 (patch)
treec4d1aa2a60198845d52b0691938ef058513c1030
parent9e19524c5ee4609b404d32a6ec1541d31585f099 (diff)
downloadphp-git-7c8c09b3cfe0da00b07edf38923018aee93f5d41.tar.gz
Revert change to stream_copy_to_stream()
-rw-r--r--ext/standard/streamsfuncs.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 92625f2680..ee57d0da86 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -267,40 +267,18 @@ PHP_FUNCTION(stream_socket_get_name)
Reads up to maxlen bytes from source stream and writes them to dest stream. */
PHP_FUNCTION(stream_copy_to_stream)
{
- php_stream *src = NULL, *dest = NULL;
+ php_stream *src, *dest;
zval *zsrc, *zdest;
- long maxlen = PHP_STREAM_COPY_ALL, copied;
+ long maxlen = PHP_STREAM_COPY_ALL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &zsrc, &zdest, &maxlen) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zsrc, &zdest, &maxlen) == FAILURE) {
RETURN_FALSE;
}
- php_stream_get_from_zval(src, &zsrc, "rb", USE_PATH | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL);
- if (!src) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to access source stream");
- RETURN_FALSE;
- }
-
- php_stream_get_from_zval(dest, &zdest, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL);
- if (!dest) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to access destination stream");
- if (Z_TYPE_P(zsrc) == IS_STRING) {
- php_stream_close(src);
- }
- RETURN_FALSE;
- }
-
- copied = php_stream_copy_to_stream(src, dest, maxlen);
-
- if (Z_TYPE_P(zsrc) == IS_STRING) {
- php_stream_close(src);
- }
-
- if (Z_TYPE_P(zdest) == IS_STRING) {
- php_stream_close(dest);
- }
+ php_stream_from_zval(src, &zsrc);
+ php_stream_from_zval(dest, &zdest);
- RETURN_LONG(copied);
+ RETURN_LONG(php_stream_copy_to_stream(src, dest, maxlen));
}
/* }}} */