From: Sara Golemon Date: Fri, 14 Jul 2006 20:50:45 +0000 (+0000) Subject: #38105 (4/3) ustrlen != USTRLEN, update variable names used to keep this block's... X-Git-Tag: RELEASE_1_0_0RC1~2415 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74eb59da592d2b947cc6f20d3beb01ecd9cdff4e;p=php #38105 (4/3) ustrlen != USTRLEN, update variable names used to keep this block's meaning clear --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 91c2e19673..8d6e79cf77 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -697,12 +697,14 @@ PHP_FUNCTION(file_put_contents) case IS_UNICODE: if (Z_USTRLEN_P(data)) { int ustrlen = u_countChar32(Z_USTRVAL_P(data), Z_USTRLEN_P(data)); - numchars = php_stream_write_unicode(stream, Z_USTRVAL_P(data), Z_USTRLEN_P(data)); - if (numchars < 0) { + int wrote_u16 = php_stream_write_unicode(stream, Z_USTRVAL_P(data), Z_USTRLEN_P(data)); + + numchars = ustrlen; + if (wrote_u16 < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d characters to %s", ustrlen, filename); numchars = -1; - } else if (numchars != ustrlen) { - int written_numchars = u_countChar32(Z_USTRVAL_P(data), numchars); + } else if (wrote_u16 != Z_USTRLEN_P(data)) { + int written_numchars = u_countChar32(Z_USTRVAL_P(data), wrote_u16); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d characters written, possibly out of free disk space", written_numchars, ustrlen); numchars = -1;