mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
tempnam() seems to be borken on many installation.
now we try tempnam first and if that fails we generate our own temp-filename with uniqid()
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
||||
- fall back to old uniqid()-behaviour when tempnam() fails in
|
||||
core.write_file.php (messju)
|
||||
- fix capitalize modifier, don't rely on buggy ucwords (Monte)
|
||||
- make html_select_date work with negative timestamps, also
|
||||
force year range to include given date unless explicitly
|
||||
|
@@ -25,11 +25,14 @@ function smarty_core_write_file($params, &$smarty)
|
||||
|
||||
// write to tmp file, then rename it to avoid
|
||||
// file locking race condition
|
||||
$_tmp_file = tempnam($_dirname, 'write_');
|
||||
$_tmp_file = tempnam($_dirname, 'wrt');
|
||||
|
||||
if (!($fd = @fopen($_tmp_file, 'w'))) {
|
||||
$smarty->trigger_error("problem writing temporary file '$_tmp_file'");
|
||||
return false;
|
||||
if (!($fd = @fopen($_tmp_file, 'wb'))) {
|
||||
$_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt');
|
||||
if (!($fd = @fopen($_tmp_file, 'wb'))) {
|
||||
$smarty->trigger_error("problem writing temporary file '$_tmp_file'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($fd, $params['contents']);
|
||||
|
Reference in New Issue
Block a user