[File_Passwd] realpath() This is the File_Passwd or PHP bugs?
| From: | Firman Wandayandi | Date: | Sat, 19 Feb 2005 19:28:45 +0000 |
| Subject: | [File_Passwd] realpath() This is the File_Passwd or PHP bugs? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-36270@lists.php.net to get a copy of this message | ||
Filename: File/Passwd/Common.php
<snip>
145: function &_open($mode, $file = null)
146: {
147: $file = realpath( is_null($file) ? $this->_file : $file );
...
170: }
</snip>
I have problem when saving the file, cause the file not exists I
think. realpath() return null when a file not exist, but how if I want
create it for the first time. So I tried to remove the realpath at the
line(147), see below.
<snip>
145: function &_open($mode, $file = null)
146: {
147: $file = is_null($file) ? $this->_file : $file;
...
170: }
</snip>
Everything is fine!
I run another realpath() test, see below:
// Paths not exists
$res = realpath('D:\\something\\path\\somefile.php');
var_dump($res); // Echoes bool(false)
$res = realpath('/something/path/somefile.php');
var_dump($res); // Echoes bool(false)
// Path is exists.
$res = realpath('somefile.php');
var_dump($res); // Echoes string(47)
"D:\Net\www\htdocs\tests\scripts\somefile.php"
$res = realpath('D:\\Net\\www\\htdocs\\tests\\scripts\\somefile.php');
var_dump($res); // Echoes string(47)
"D:\Net\www\htdocs\tests\scripts\somefile.php"
So what happen with that? File_Passwd bugs or PHP bugs or Nothing or
Something Else?
Regards,
Firman
--
.:: OrangEnigmA : Never Dreamt Before ::.