From d57790d04d64c8d48571e125743994abc8b06a10 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Mon, 18 Aug 2008 21:26:30 +0000 Subject: [PATCH] - MFB: don't use /tmp as tmpdir and avoid endless loop when fopen or tmpnam failed --- ext/standard/tests/file/bug27508.phpt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ext/standard/tests/file/bug27508.phpt b/ext/standard/tests/file/bug27508.phpt index 88354c15c6..a2f40532b9 100644 --- a/ext/standard/tests/file/bug27508.phpt +++ b/ext/standard/tests/file/bug27508.phpt @@ -45,9 +45,16 @@ class FileStream { stream_wrapper_register("myFile", "FileStream") or die("Failed to register protocol"); -$tn = tempnam('/tmp', 'foo'); +$tmp_dir = __DIR__; +$tn = tempnam($tmp_dir, 'foo'); +if (!$tn) { + die("tempnam failed"); +} -$fp = fopen("myFile://" . urlencode((binary)$tn), "w+"); +$fp = fopen("myFile://" . urlencode($tn), "w+"); +if (!$fp) { + die("fopen failed"); +} fwrite($fp, b"line1\n"); fwrite($fp, b"line2\n"); -- 2.40.0