File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file / file_put_contents_variation5.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test file_put_contents() function : variation - include path testing
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
--FILE--
<?php


$thisTestDir = dirname(__FILE__) . '/' .basename(__FILE__, ".php") . ".directory";
mkdir($thisTestDir);
chdir($thisTestDir);

$filename = basename(__FILE__, ".php") . ".tmp"; 
$scriptLocFile = dirname(__FILE__)."/".$filename;

$newpath = "rubbish";
set_include_path($newpath);
runtest();
$newpath = "";
set_include_path($newpath);
runtest();
set_include_path(null);
runtest();
set_include_path(";;  ; ;c:\\rubbish");
runtest();

chdir(dirname(__FILE__));
rmdir($thisTestDir);


function runtest() {
   global $scriptLocFile, $filename;
   file_put_contents($filename, (binary) "File written in working directory", FILE_USE_INCLUDE_PATH);
   if(file_exists($scriptLocFile)) {
      echo "Fail - this is PHP52 behaviour\n";
      unlink($scriptLocFile);
   }else {
      $line = file_get_contents($filename); 
      echo "$line\n";
      unlink($filename);     
   }
}
?>
===DONE===
--EXPECT--
File written in working directory
File written in working directory
File written in working directory
File written in working directory
===DONE===


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>