From 2e4ab6899588d586430d5e60606a24b31118dfc0 Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Wed, 27 Sep 2000 16:08:26 +0000 Subject: Automatic conversion might cause interpretation of 0xff as EOF, so we store the result in an object of type int first. Submitted by: melchers@cis.fu-berlin.de --- ext/standard/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/standard/file.c') diff --git a/ext/standard/file.c b/ext/standard/file.c index cd6a4ef638..9d810ca4dc 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -908,6 +908,7 @@ PHP_FUNCTION(fgetc) { int issock=0; int socketd=0; void *what; + int result; if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { WRONG_PARAM_COUNT; @@ -922,10 +923,11 @@ PHP_FUNCTION(fgetc) { } buf = emalloc(sizeof(int)); - if ((*buf = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) { + if ((result = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) { efree(buf); RETVAL_FALSE; } else { + buf[0]=result; buf[1]='\0'; return_value->value.str.val = buf; return_value->value.str.len = 1; -- cgit v1.2.1