Skip to content

Commit 152f6aa

Browse files
committed
Fix creating temporary files with open_basedir restrictions.
if tempnam() is called with an empty first parameter, open_basedir restrictions set in. Use Horde_Util::getTempFile() consistently, and make sure that it always uses a valid temporary directory.
1 parent b5133ae commit 152f6aa

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎lib/Horde/Text/Diff/Engine/Shell.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function diff($from_lines, $to_lines)
3636
array_walk($to_lines, array('Horde_Text_Diff', 'trimNewlines'));
3737

3838
// Execute gnu diff or similar to get a standard diff file.
39-
$from_file = tempnam(null, 'Horde_Text_Diff');
40-
$to_file = tempnam(null, 'Horde_Text_Diff');
39+
$from_file = Horde_Util::getTempFile('Horde_Text_Diff');
40+
$to_file = Horde_Util::getTempFile('Horde_Text_Diff');
4141
$fp = fopen($from_file, 'w');
4242
fwrite($fp, implode("\n", $from_lines));
4343
fclose($fp);

‎package.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</stability>
3030
<license uri="http://opensource.org/licenses/lgpl-license.php">LGPL</license>
3131
<notes>
32-
*
32+
* [jan] Fix creating temporary files with open_basedir restrictions.
3333
</notes>
3434
<contents>
3535
<dir baseinstalldir="/" name="/">
@@ -279,7 +279,7 @@
279279
<date>2011-04-06</date>
280280
<license uri="http://opensource.org/licenses/lgpl-license.php">LGPL</license>
281281
<notes>
282-
*
282+
* [jan] Fix creating temporary files with open_basedir restrictions.
283283
</notes>
284284
</release>
285285
</changelog>

0 commit comments

Comments
 (0)