In the spirit of fopen's optional [, bool use_include_path].. is this
something that can be added to is_readable?
ie:
bool is_readable ( string filename [, bool use_include_path] )
-ralph
Ralph Schindler wrote:
In the spirit of fopen's optional [, bool use_include_path].. is this
something that can be added to is_readable?ie:
bool is_readable ( string filename [, bool use_include_path] )
we can always dream ..
so far the answer has been that this parameter should never have been
added to fopen()
, and that file_exists()
, is_readable and friends should
never get this feature. IIRC the reason was that they should not be
reading the include path, however even proposing to be atleast able to
pass in an order list of search pathes has been shot down. nevermind the
common use case for such a feature.
sigh
regards,
Lukas
bool is_readable ( string filename [, bool use_include_path] )
we can always dream ..
so far the answer has been that this parameter should never have been
added tofopen()
, and thatfile_exists()
, is_readable and friends should
never get this feature. IIRC the reason was that they should not be
reading the include path, however even proposing to be atleast able to
pass in an order list of search pathes has been shot down. nevermind the
common use case for such a feature.
How about something which will save having to resolve that path twice?
$realpath = stream_resolve_include_path($relativepath);
if ($realpath && is_readable($realpath)) {
$fp = fopen($realpath, 'rb', false);
} else {
/* File isn't readable */
}
The code for doing this is all in there, it'd just need some quick
exposing to userspace...
-Sara
Sara Golemon wrote:
bool is_readable ( string filename [, bool use_include_path] )
we can always dream ..
I prefer the word "mature" instead of dream ;)
How about something which will save having to resolve that path twice?
$realpath = stream_resolve_include_path($relativepath);
if ($realpath && is_readable($realpath)) {
$fp = fopen($realpath, 'rb', false);
} else {
/* File isn't readable */
}The code for doing this is all in there, it'd just need some quick
exposing to userspace...-Sara
that is an interesting suggestion,.. in researching other options, how
about this:
string realpath ( string path [, bool use_include_path])
This makes more sense to me, plus it can be done once and wont have to
worry about including this in the family of file functions. This seems
like a logical place to resolve paths., including file that reside in
the relative include-path.
Think this can fly?
-ralph
Is it worth even attempting to create a patch and submitting it to do
the following:
string realpath ( string path [, bool use_include_path])
or will it be shot down?
There must be a way to find the full path to a file that resides in one
of the include paths no? I can understand not wanting it in fopen, and
file_exists()
, but this seems like the appropriate place.
-ralph
-1 for the idea. I think using include_path for realpath()
goes
against the code logic that should be applied by realpath.
Ilia Alshanetsky