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

From: Date: Wed, 14 May 2003 01:08:48 +0000
Subject: cvs: php4(PHP_4_3) /ext/standard file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20885@lists.php.net to get a copy of this message
sas Tue May 13 21:08:48 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard file.c Log: Fix file_get_contents segfault on empty file Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.279.2.19 php4/ext/standard/file.c:1.279.2.20 --- php4/ext/standard/file.c:1.279.2.19 Mon May 12 20:18:27 2003 +++ php4/ext/standard/file.c Tue May 13 21:08:47 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.279.2.19 2003/05/13 00:18:27 wez Exp $ */ +/* $Id: file.c,v 1.279.2.20 2003/05/14 01:08:47 sas Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -434,14 +434,15 @@ } /* uses mmap if possible */ - if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) >= 0) { - + if ((len = php_stream_copy_to_mem(stream, &contents, PHP_STREAM_COPY_ALL, 0)) > 0) { if (PG(magic_quotes_runtime)) { contents = php_addslashes(contents, len, &newlen, 1 TSRMLS_CC); /* 1 = free source string */ len = newlen; } RETVAL_STRINGL(contents, len, 0); + } else if (len == 0) { + RETVAL_EMPTY_STRING(); } else { RETVAL_FALSE; }

« previous php.cvs (#20885) next »