Web lists-archives.com

Re: [PHP] is_readable fails with a variable parameter




That is the reason. I assumed the file already existed. is_readable is part
of the cache affected functions:

http://php.net/manual/en/function.clearstatcache.php

Try doing that and see if that makes a difference.

On Tue, Sep 29, 2015 at 1:04 PM, Tommy Peterson <stpetersn@xxxxxxxxxxx>
wrote:

> Also I should mention that I thought that maybe the zip file was not being
> created in time for this point of my code. But I double checked that that
> file is there at that point of the code. So again it exists. And if it were
> the other scenario--permissions--the code would not be able to execute if
> the file path/name were hard coded. So I'm stumped.
>
> Date: Tue, 29 Sep 2015 13:00:55 -0400
> Subject: Re: [PHP] is_readable fails with a variable parameter
> From: azizsaleh@xxxxxxxxx
> To: stpetersn@xxxxxxxxxxx
> CC: php-general@xxxxxxxxxxxxx
>
> Does the actual filename character count match 111?
>
> On Tue, Sep 29, 2015 at 12:58 PM, Tommy Peterson <stpetersn@xxxxxxxxxxx>
> wrote:
> string(111) and then the correct path/filename
>
>
>
> Date: Tue, 29 Sep 2015 12:56:11 -0400
>
> Subject: Re: [PHP] is_readable fails with a variable parameter
>
> From: azizsaleh@xxxxxxxxx
>
> To: stpetersn@xxxxxxxxxxx
>
> CC: php-general@xxxxxxxxxxxxx
>
>
>
> var_dump($file_path_name);
>
>
>
> What do you get?
>
>
>
> On Tue, Sep 29, 2015 at 12:51 PM, Tommy Peterson <stpetersn@xxxxxxxxxxx>
> wrote:
>
> I am using a PHP API that uses is_readable as a check before a particular
> function does anything. The problem that I am having is that if I do
> something like
>
>
>
>
>
>
>
> is_readable($file_path_name);
>
>
>
>
>
>
>
> my code terminates as is_readable says it cannot read the file or there is
> a permissions issue. But if I go to the file path/name in $file_path_name
> (echoing it out to make sure) I can see and open the file.
>
>
>
>
>
>
>
> If I edit the same code and do something like
>
>
>
>
>
>
>
> is_readable("/path/to/the/file/filename.zip")
>
>
>
>
>
>
>
> the same code executes just fine.
>
>
>
>
>
>
>
> At first I thought the variable was some how getting over written. But it
> isn't. It is just somehow the variable is not be interpolated correctly by
> is_readable like a hard coded path/file name is.
>
>
>
>
>
>
>
> Any thoughts?
>
>
>
>
>
>
>
> This is on Linux. And this is PHP 5.4.43
>
>
>
>
>
>
>
>