Bug #61339 [Opn]: is_readable() causes crash in special cases
| From: | ziegenberg at web dot de | Date: | Sat, 10 Mar 2012 12:06:03 +0000 |
| Subject: | Bug #61339 [Opn]: is_readable() causes crash in special cases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168328@lists.php.net to get a copy of this message | ||
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:
Here is a crash report I found, perhaps this helps:
-----
Version=1
EventType=APPCRASH
EventTime=129758533564007575
ReportType=2
Consent=1
ReportIdentifier=214d7de4-6aa6-11e1-bd6c-4c8093870ef0
IntegratorReportIdentifier=214d7de3-6aa6-11e1-bd6c-4c8093870ef0
WOW64=1
Response.type=4
Sig[0].Name=Anwendungsname
Sig[0].Value=httpd.exe
Sig[1].Name=Anwendungsversion
Sig[1].Value=2.2.22.0
Sig[2].Name=Anwendungszeitstempel
Sig[2].Value=4f4a84ad
Sig[3].Name=Fehlermodulname
Sig[3].Value=php5ts.dll
Sig[4].Name=Fehlermodulversion
Sig[4].Value=5.3.9.0
Sig[5].Name=Fehlermodulzeitstempel
Sig[5].Value=4f591617
Sig[6].Name=Ausnahmecode
Sig[6].Value=c0000005
Sig[7].Name=Ausnahmeoffset
Sig[7].Value=000a57a0
DynamicSig[1].Name=Betriebsystemversion
DynamicSig[1].Value=6.1.7601.2.1.0.256.48
DynamicSig[2].Name=Gebietsschema-ID
DynamicSig[2].Value=1031
DynamicSig[22].Name=Zusatzinformation 1
DynamicSig[22].Value=0a9e
DynamicSig[23].Name=Zusatzinformation 2
DynamicSig[23].Value=0a9e372d3b4ad19135b953a78882e789
DynamicSig[24].Name=Zusatzinformation 3
DynamicSig[24].Value=0a9e
DynamicSig[25].Name=Zusatzinformation 4
DynamicSig[25].Value=0a9e372d3b4ad19135b953a78882e789
UI[2]=C:\apache2\bin\httpd.exe
UI[3]=Apache HTTP Server funktioniert nicht mehr
UI[4]=Windows kann online nach einer Lösung für das Problem suchen.
UI[5]=Online nach einer Lösung suchen (empfohlen)
UI[6]=Später nach einer Lösung suchen (empfohlen)
UI[7]=SchlieÃen
UI[8]=Apache HTTP Server wurde beendet und geschlossen.
UI[9]=Die Anwendung wird aufgrund eines Problems nicht mehr richtig ausgeführt. Sie erhalten
Nachricht, wenn eine Lösung verfügbar ist.
UI[10]=S&chlieÃen
LoadedModule[0]=C:\apache2\bin\httpd.exe
LoadedModule[1]=C:\Windows\SysWOW64\ntdll.dll
LoadedModule[2]=C:\Windows\syswow64\kernel32.dll
LoadedModule[3]=C:\Windows\syswow64\KERNELBASE.dll
LoadedModule[4]=C:\apache2\bin\libhttpd.dll
LoadedModule[5]=C:\Windows\syswow64\WS2_32.dll
LoadedModule[6]=C:\Windows\syswow64\msvcrt.dll
LoadedModule[7]=C:\Windows\syswow64\RPCRT4.dll
LoadedModule[8]=C:\Windows\syswow64\SspiCli.dll
LoadedModule[9]=C:\Windows\syswow64\CRYPTBASE.dll
LoadedModule[10]=C:\Windows\SysWOW64\sechost.dll
LoadedModule[11]=C:\Windows\syswow64\NSI.dll
LoadedModule[12]=C:\Windows\system32\MSWSOCK.dll
LoadedModule[13]=C:\Windows\syswow64\user32.dll
LoadedModule[14]=C:\Windows\syswow64\GDI32.dll
LoadedModule[15]=C:\Windows\syswow64\LPK.dll
LoadedModule[16]=C:\Windows\syswow64\USP10.dll
LoadedModule[17]=C:\Windows\syswow64\ADVAPI32.dll
LoadedModule[18]=C:\apache2\bin\libaprutil-1.dll
LoadedModule[19]=C:\apache2\bin\libapriconv-1.dll
LoadedModule[20]=C:\apache2\bin\libapr-1.dll
LoadedModule[21]=C:\Windows\syswow64\SHELL32.dll
LoadedModule[22]=C:\Windows\syswow64\SHLWAPI.dll
LoadedModule[23]=C:\Windows\system32\MSVCR100.dll
LoadedModule[24]=C:\Windows\system32\IMM32.DLL
LoadedModule[25]=C:\Windows\syswow64\MSCTF.dll
LoadedModule[26]=C:\Windows\SysWOW64\nvinit.dll
LoadedModule[27]=C:\Windows\System32\wship6.dll
LoadedModule[28]=C:\Windows\System32\wshtcpip.dll
LoadedModule[29]=C:\apache2\modules\mod_actions.so
LoadedModule[30]=C:\apache2\modules\mod_alias.so
LoadedModule[31]=C:\apache2\modules\mod_asis.so
LoadedModule[32]=C:\apache2\modules\mod_auth_basic.so
LoadedModule[33]=C:\apache2\modules\mod_authn_default.so
LoadedModule[34]=C:\apache2\modules\mod_authn_file.so
LoadedModule[35]=C:\apache2\modules\mod_authz_default.so
LoadedModule[36]=C:\apache2\modules\mod_authz_groupfile.so
LoadedModule[37]=C:\apache2\modules\mod_authz_host.so
LoadedModule[38]=C:\apache2\modules\mod_authz_user.so
LoadedModule[39]=C:\apache2\modules\mod_autoindex.so
LoadedModule[40]=C:\apache2\modules\mod_cgi.so
LoadedModule[41]=C:\apache2\modules\mod_deflate.so
LoadedModule[42]=C:\apache2\bin\zlib1.dll
LoadedModule[43]=C:\apache2\modules\mod_dir.so
LoadedModule[44]=C:\apache2\modules\mod_env.so
LoadedModule[45]=C:\apache2\modules\mod_expires.so
LoadedModule[46]=C:\apache2\modules\mod_include.so
LoadedModule[47]=C:\apache2\modules\mod_isapi.so
LoadedModule[48]=C:\apache2\modules\mod_log_config.so
LoadedModule[49]=C:\apache2\modules\mod_mime.so
LoadedModule[50]=C:\apache2\modules\mod_negotiation.so
LoadedModule[51]=C:\apache2\modules\mod_rewrite.so
LoadedModule[52]=C:\apache2\modules\mod_setenvif.so
LoadedModule[53]=C:\PHP\php5apache2_2.dll
LoadedModule[54]=C:\PHP\php5ts.dll
LoadedModule[55]=C:\Windows\syswow64\OLEAUT32.dll
LoadedModule[56]=C:\Windows\syswow64\ole32.dll
LoadedModule[57]=C:\Windows\system32\ODBC32.dll
LoadedModule[58]=C:\Windows\system32\DNSAPI.dll
LoadedModule[59]=C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll
LoadedModule[60]=C:\Windows\system32\odbcint.dll
LoadedModule[61]=C:\PHP\ext\php_bz2.dll
LoadedModule[62]=C:\PHP\ext\php_curl.dll
LoadedModule[63]=C:\apache2\bin\LIBEAY32.dll
LoadedModule[64]=C:\apache2\bin\SSLEAY32.dll
LoadedModule[65]=C:\Windows\syswow64\WLDAP32.dll
LoadedModule[66]=C:\PHP\ext\php_fileinfo.dll
LoadedModule[67]=C:\PHP\ext\php_gd2.dll
LoadedModule[68]=C:\PHP\ext\php_gettext.dll
LoadedModule[69]=C:\PHP\ext\php_gmp.dll
LoadedModule[70]=C:\PHP\ext\php_mbstring.dll
LoadedModule[71]=C:\PHP\ext\php_mysql.dll
LoadedModule[72]=C:\PHP\ext\php_mysqli.dll
LoadedModule[73]=C:\PHP\ext\php_openssl.dll
LoadedModule[74]=C:\PHP\ext\php_pdo_mysql.dll
LoadedModule[75]=C:\PHP\ext\php_pdo_sqlite.dll
LoadedModule[76]=C:\PHP\ext\php_soap.dll
LoadedModule[77]=C:\PHP\ext\php_sockets.dll
LoadedModule[78]=C:\PHP\ext\php_sqlite3.dll
LoadedModule[79]=C:\PHP\ext\php_tidy.dll
LoadedModule[80]=C:\PHP\ext\php_xmlrpc.dll
LoadedModule[81]=C:\PHP\ext\php_xsl.dll
LoadedModule[82]=C:\PHP\ext\php_exif.dll
LoadedModule[83]=C:\PHP\ext\php_xdebug.dll
FriendlyEventName=Nicht mehr funktionsfähig
ConsentKey=APPCRASH
AppName=Apache HTTP Server
AppPath=C:\apache2\bin\httpd.exe
-----
After installing the 5.3 snapshot the version named there is 5.3.9, but for 5.3.10 it's the
same.
Previous Comments:
------------------------------------------------------------------------
[2012-03-10 12:00:35] ziegenberg at web dot de
I tested all the current Windows VC9 TS snapshots.
Results:
5.3 -> error still present, also when using include() instead of is_readable().
5.4 -> okay, no error.
Trunk (5.5-dev?) -> okay, no error.
------------------------------------------------------------------------
[2012-03-10 11:33:34] pajoye@php.net
is_readable does not read the file, so no, it is not what can causes a crash if
the contents of the file changed or not.
include and require may have a problem due to a bug in the parsing code, which is
fixed in svn. Please try using a 5.3 snapshot.
------------------------------------------------------------------------
[2012-03-10 11:29:28] ziegenberg at web dot de
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?
------------------------------------------------------------------------
[2012-03-10 10:13:11] pajoye@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