Re: Saving compiled template fails. file_exists() problem?
| From: | Craig H. Anderson | Date: | Sun, 29 Dec 2002 09:09:46 +0000 |
| Subject: | Re: Saving compiled template fails. file_exists() problem? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6959@lists.php.net to get a copy of this message | ||
I wrote a small standalone script that demonstrates
the problem with file_exists() on relative files.
<?php
if (!chdir('/tmp')) {
echo "chdir to /tmp failed\n";
exit('chdir failed');
}
$cwd = posix_getcwd();
if ($cwd == '/tmp') {
echo "Confirmed that cwd is /tmp\n";} else {
echo "cwd is $cwd not /tmp\n";
exit('chdir failed');
}
$subdir = 'glop.dir';
if (!mkdir($subdir,0755)) {
echo "mkdir $subdir failed\n";
exit("mkdir failed");
}
if (file_exists($subdir)) {
echo "file_exists says that $subdir exists\n";} else {
echo "file_exists says that $subdir does NOT exist\n";} $fd = $cwd; $fd .= '/'; $fd .= $subdir; if (file_exists($fd)) {
echo "file_exists says that $fd exists\n";} else {
echo "file_exists says that $fd does NOT exist\n";} /* run when /tmp/glop.dir does not exist. output is: Confirmed that cwd is /tmp file_exists says that glop.dir does NOT exist file_exists says that /tmp/glop.dir exists */ ?>