From: Pierre Joye Date: Thu, 14 Jun 2007 19:56:35 +0000 (+0000) Subject: - #41609, file_put_contents is not binary safe when a binary string is X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~455 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a06fbeebc51ab5541f0e1733287a40b381161d3e;p=php - #41609, file_put_contents is not binary safe when a binary string is given (make it consistent with fwrite&co when unicode=1) --- diff --git a/ext/standard/file.c b/ext/standard/file.c index b1c7bae415..375555bc40 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -646,7 +646,7 @@ PHP_FUNCTION(file_put_contents) if (flags & PHP_FILE_APPEND) { mode[0] = 'a'; } - if (flags & PHP_FILE_BINARY) { + if (flags & PHP_FILE_BINARY || (Z_TYPE_P(data) == IS_STRING)) { mode[1] = 'b'; } else if (flags & PHP_FILE_TEXT) { mode[1] = 't';