cvs: smarty / NEWS /libs/core core.write_file.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1093785390@cvsserver> |
messju Sun Aug 29 09:16:30 2004 EDT
Modified files:
/smarty NEWS
/smarty/libs/core core.write_file.php
Log:
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()
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.469&r2=1.470&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.469 smarty/NEWS:1.470
--- smarty/NEWS:1.469 Mon Aug 23 14:34:12 2004
+++ smarty/NEWS Sun Aug 29 09:16:29 2004
@@ -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
http://cvs.php.net/diff.php/smarty/libs/core/core.write_file.php?r1=1.12&r2=1.13&ty=u
Index: smarty/libs/core/core.write_file.php
diff -u smarty/libs/core/core.write_file.php:1.12 smarty/libs/core/core.write_file.php:1.13
--- smarty/libs/core/core.write_file.php:1.12 Mon Jul 12 11:05:30 2004
+++ smarty/libs/core/core.write_file.php Sun Aug 29 09:16:30 2004
@@ -25,11 +25,14 @@
// 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']);
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php