diff --git a/admin/admin_attachments.php b/admin/admin_attachments.php
index 5ecaebd7c..098e8785d 100644
--- a/admin/admin_attachments.php
+++ b/admin/admin_attachments.php
@@ -220,7 +220,7 @@ if ($check_upload) {
}
if (!$error) {
- if (!($fp = @fopen($upload_dir . '/0_000000.000', 'w'))) {
+ if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
$error = true;
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $attach_config['upload_dir']) . '
';
} else {
@@ -375,7 +375,7 @@ if ($check_image_cat) {
}
if (!$error) {
- if (!($fp = @fopen($upload_dir . '/0_000000.000', 'w'))) {
+ if (!($fp = @fopen($upload_dir . '/0_000000.000', 'wb'))) {
$error = true;
$error_msg = sprintf($lang['DIRECTORY_NOT_WRITEABLE'], $upload_dir) . '
';
} else {
diff --git a/library/includes/classes/emailer.php b/library/includes/classes/emailer.php
index a315e807a..966a07a40 100644
--- a/library/includes/classes/emailer.php
+++ b/library/includes/classes/emailer.php
@@ -130,7 +130,7 @@ class emailer
}
}
- if (!($fd = @fopen($tpl_file, 'r'))) {
+ if (!($fd = @fopen($tpl_file, 'rb'))) {
bb_die('Failed opening template file :: ' . $tpl_file);
}
diff --git a/library/includes/functions_atom.php b/library/includes/functions_atom.php
index e3e5e613c..a0ecf1e46 100644
--- a/library/includes/functions_atom.php
+++ b/library/includes/functions_atom.php
@@ -211,7 +211,7 @@ function create_atom($file_path, $mode, $id, $title, $topics)
}
$atom .= "";
@unlink($file_path);
- $fp = fopen($file_path, "w");
+ $fp = fopen($file_path, 'wb');
fwrite($fp, $atom);
fclose($fp);
return true;
diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php
index fc9df9c85..7d7a11f88 100644
--- a/library/includes/functions_torrent.php
+++ b/library/includes/functions_torrent.php
@@ -286,7 +286,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
if ($bb_cfg['bt_disable_dht']) {
$tor['info']['private'] = (int)1;
- $fp = fopen($filename, 'w+');
+ $fp = fopen($filename, 'wb+');
fwrite($fp, bencode($tor));
fclose($fp);
}