cvs: php4(PHP_4_2_0) /ext/standard file.c

From: Date: Tue, 27 Aug 2002 00:22:18 +0000
Subject: cvs: php4(PHP_4_2_0) /ext/standard file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13690@lists.php.net to get a copy of this message
helly Mon Aug 26 20:22:18 2002 EDT Modified files: (Branch: PHP_4_2_0) /php4/ext/standard file.c Log: MFH Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.205.2.3 php4/ext/standard/file.c:1.205.2.4 --- php4/ext/standard/file.c:1.205.2.3 Wed Jul 10 10:59:21 2002 +++ php4/ext/standard/file.c Mon Aug 26 20:22:17 2002 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.205.2.3 2002/07/10 14:59:21 jason Exp $ */ +/* $Id: file.c,v 1.205.2.4 2002/08/27 00:22:17 helly Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1232,6 +1232,7 @@ int issock=0; int socketd=0; void *what; + char *buffer = NULL; switch (ZEND_NUM_ARGS()) { case 2: @@ -1265,26 +1266,29 @@ } if (!arg3 && PG(magic_quotes_runtime)) { - zval_copy_ctor(*arg2); - php_stripslashes(Z_STRVAL_PP(arg2), &num_bytes TSRMLS_CC); + buffer = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); + php_stripslashes(buffer, &num_bytes TSRMLS_CC); } #if HAVE_PHP_STREAM if (type == le_stream) { - ret = php_stream_write((php_stream *) what, Z_STRVAL_PP(arg2), num_bytes); + ret = php_stream_write((php_stream *) what, buffer, num_bytes); } else #endif if (issock){ - ret = SOCK_WRITEL(Z_STRVAL_PP(arg2), num_bytes, socketd); + ret = SOCK_WRITEL(buffer, num_bytes, socketd); } else { #ifdef HAVE_FLUSHIO if (type == le_fopen) { fseek((FILE *) what, 0, SEEK_CUR); } #endif - ret = fwrite(Z_STRVAL_PP(arg2), 1, num_bytes, (FILE *) what); + ret = fwrite(buffer, 1, num_bytes, (FILE *) what); + } + if (buffer) { + efree(buffer); } RETURN_LONG(ret); }

« previous php.cvs (#13690) next »