--TEST--
Test fopen() function : variation: use include path (path is bad) create a file (relative)
---XFAIL--
-Pending completion of Unicode streams
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
--FILE--
* Alias to functions:
*/
-echo "*** Testing fopen() : variation ***\n";
set_include_path("rubbish");
testme();
restore_include_path();
function testme() {
- $tmpfile = 'fopen_variation12.tmp';
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
- fwrite($h, "This is the test file");
+ fwrite($h, (binary) "This is the test file");
fclose($h);
unlink($tmpfile);
}
+
$scriptDirFile = dirname(__FILE__).'/'.$tmpfile;
- $h = fopen($scriptDirFile, "r");
+ $h = @fopen($scriptDirFile, "r");
if ($h === false) {
echo "Not created in script dir\n";
}
?>
===DONE===
--EXPECT--
-*** Testing fopen() : variation ***
-Not created in working dir
-created in script dir
+created in working dir
+Not created in script dir
===DONE===
Test fopen() function : variation: use include path create and read a file (relative)
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
---XFAIL--
-Bug #46680
--FILE--
<?php
/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
require_once('fopen_include_path.inc');
-echo "*** Testing fopen() : variation ***\n";
$thisTestDir = "fopenVariation16.dir";
mkdir($thisTestDir);
chdir($thisTestDir);
$newpath = create_include_path();
set_include_path($newpath);
runtest();
+
$newpath = generate_next_path();
set_include_path($newpath);
runtest();
$extraDir = "extraDir";
mkdir($dir1.'/'.$extraDir);
+ mkdir($extraDir);
$tmpfile = $extraDir.'/fopen_variation16.tmp';
+
$h = fopen($tmpfile, "w+", true);
- fwrite($h, "This is the test file");
+ fwrite($h, (binary) "This is the test file");
fclose($h);
- $h = fopen($dir1.'/'.$tmpfile, "r");
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
if ($h === false) {
echo "Not created in dir1\n";
}
echo "could not find file for reading\n";
}
else {
- echo "found file again in dir1\n";
+ echo "found file - not in dir1\n";
fclose($h);
}
- unlink($dir1.'/'.$tmpfile);
+ unlink($tmpfile);
rmdir($dir1.'/'.$extraDir);
+ rmdir($extraDir);
}
?>
===DONE===
--EXPECT--
-*** Testing fopen() : variation ***
-created in dir1
-found file again in dir1
-created in dir1
-found file again in dir1
+Not created in dir1
+found file - not in dir1
+Not created in dir1
+found file - not in dir1
===DONE===