Edit report at https://bugs.php.net/bug.php?id=61339&edit=1

 ID:                 61339
 User updated by:    ziegenberg at web dot de
 Reported by:        ziegenberg at web dot de
 Summary:            is_readable() causes crash in special cases
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Windows 7 Pro 64bit
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

Yes, it's the is_readable() function:

...
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . $theme . 
        DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . 
        str_replace('_', DIRECTORY_SEPARATOR, $layout) . '.layout.php';

if (!is_readable($path))
{
    $host = self::getHost();
    throw new Cz_Request_Exception("Action configuration error: layout file 
'$path' for action '$action' and host '$host' does not exist or is not 
readable.");
}
...

The path seems to be a part of the problem, but the error depends on more 
factors. Here are some details of my research:

1) Not 8 spaces are required to create the error, one additional space is 
enough. This single space can be inserted somewhere in the file to produce the 
error.

2) I could reproduce it with two different paths, because the Apache 
directories in my tests where not the same. One is "C:\apache2" and the other 
is "C:\Apache24". The error occurred in both versions.

3) When I try to create a script to reproduce the bug I don't get an error. 
Also when I call is_readable() on the original file from there.

4) I renamed the template file. Same behaviour.

5) file_get_contents(), readfile(), file_exists(), file(), fopen() on the same 
file work as expected (no error).

6) include() and require() behave like is_readable() (error)


Is there a way to get more debug information?


Previous Comments:
------------------------------------------------------------------------
[2012-03-10 10:13:11] paj...@php.net

And how is the path? 

Are you sure it is is_readable and not the include/require function which 
crashes?

------------------------------------------------------------------------
[2012-03-10 09:47:40] ziegenberg at web dot de

Description:
------------
While I was working on some simple HTML templates I suddently got an error. 
Apache (2.2.22 or 2.4.1, both from apachelounge.com) didn't reply my request 
anymore. 

I spend hours with debugging and found the cause for the bug: a call of the 
is_readable() function, which checked the template file I have been working on.

After further checks I found the "problem" in the file: 
8 simple spaces, added by the editor as line indent.

If I remove the spaces, everything works fine. If I add the spaces, php ends 
processing when calling is_readable() on the file. I can repeat it as often as 
I want - it's the same file, in the same directory, with the same rights.

I wanted to create an example for you, but if I copy the file to another path, 
the error doesn't occur anymore. So the problem seems to be dependent of the 
file's path and content. Also PHP doesn't create an error, it just aborts the 
request (and the shutdown function isn't called).

Test script:
---------------
sorry, not possible

Expected result:
----------------
TRUE for the call of is_readable(), as the file exists and is readable

Actual result:
--------------
crash


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61339&edit=1

Reply via email to