]> granicus.if.org Git - php/commitdiff
fix test and prevent endless loop
authorAntony Dovgal <tony2001@php.net>
Thu, 9 Nov 2006 00:33:54 +0000 (00:33 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 9 Nov 2006 00:33:54 +0000 (00:33 +0000)
ext/standard/tests/file/bug27508.phpt

index 95a3122184f5c2758186eacc70b8dc95e41bc7e6..cc4c8b87b675fdaab058089d659fb423ade01713 100644 (file)
@@ -30,6 +30,9 @@ class FileStream {
 
     function stream_eof() 
     {
+        if (!$this->fp) {
+            return true;
+        }
         return feof($this->fp);
     }
 
@@ -44,7 +47,7 @@ stream_wrapper_register("myFile", "FileStream")
 
 $tn = tempnam('/tmp', 'foo');
 
-$fp = fopen("myFile://" . urlencode($tn), "w+");
+$fp = fopen("myFile://" . urlencode((binary)$tn), "w+");
 
 fwrite($fp, b"line1\n");
 fwrite($fp, b"line2\n");