From: Pierre Joye Date: Mon, 18 Aug 2008 21:26:30 +0000 (+0000) Subject: - MFB: don't use /tmp as tmpdir and avoid endless loop when fopen or tmpnam failed X-Git-Tag: BEFORE_HEAD_NS_CHANGE~653 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d57790d04d64c8d48571e125743994abc8b06a10;p=php - MFB: don't use /tmp as tmpdir and avoid endless loop when fopen or tmpnam failed --- 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");