cvs: php-src /ext/standard/tests/file bug27508.phpt
| From: | Pierre-Alain Joye | Date: | Mon, 18 Aug 2008 21:26:30 +0000 |
| Subject: | cvs: php-src /ext/standard/tests/file bug27508.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-52507@lists.php.net to get a copy of this message | ||
pajoye Mon Aug 18 21:26:30 2008 UTC
Modified files:
/php-src/ext/standard/tests/file bug27508.phpt
Log:
- MFB: don't use /tmp as tmpdir and avoid endless loop when fopen or tmpnam failed
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug27508.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/standard/tests/file/bug27508.phpt
diff -u php-src/ext/standard/tests/file/bug27508.phpt:1.4
php-src/ext/standard/tests/file/bug27508.phpt:1.5
--- php-src/ext/standard/tests/file/bug27508.phpt:1.4 Wed Feb 21 22:08:00 2007
+++ php-src/ext/standard/tests/file/bug27508.phpt Mon Aug 18 21:26:30 2008
@@ -45,9 +45,16 @@
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");