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

 ID:               52312
 Comment by:       v dot damore at gmail dot com
 Reported by:      v dot damore at gmail dot com
 Summary:          PHP lstat problem
 Status:           Feedback
 Type:             Bug
 Package:          Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

After having set breakpoint tsrm_realpath_r and I have execute step by
step debug.

I think is interesting that after execution tsrm_virtual_cwd.c of line
681 execution continue on line 890.



gdb) break tsrm_realpath_r

Breakpoint 1 at 0x2b0b3c9f2702: file
/usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c,
line 611.

(gdb) continue

Continuing.



Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0
"/usr/local/myspace/webspace/httpdocs/test.php", start=1, len=45,
ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0,
link_is_dir=0x0)

    at
/usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611

611             int directory = 0;

(gdb) step

624                     if (len <= start) {

(gdb) step

628                     i = len;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

630                             i--;

(gdb) step

629                     while (i > start && !IS_SLASH(path[i-1])) {

(gdb) step

633                     if (i == len ||

(gdb) step

639                     } else if (i == len - 2 && path[i] == '.' && path[i+1] 
== '.') {

(gdb) step

677                     path[len] = 0;

(gdb) step

679                     save = (use_realpath != CWD_EXPAND);

(gdb) step

681                     if (start && save && CWDG(realpath_cache_size_limit)) {

(gdb) watch save

Hardware watchpoint 2: save

(gdb) print save

$1 = 1

(gdb) print start

$2 = 1

(gdb) print realpath_cache_size_limit

No symbol "realpath_cache_size_limit" in current context.

(gdb) step

890                     if (save && lstat(path, &st) < 0) {

(gdb)


Previous Comments:
------------------------------------------------------------------------
[2010-07-13 00:59:44] ras...@php.net

Set a bp and step through tsrm_realpath_r and figure out why it isn't
getting to 

the realptath_cache_find() call there.  Seems like it should be getting
there from 

the backtraces.

------------------------------------------------------------------------
[2010-07-13 00:52:21] v dot damore at gmail dot com

Please also note that realpath_cache_size and realpath_cache_ttl are
currently set to following values:



[r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep
real



<tr><td class="e">realpath_cache_size</td><td class="v">1024k</td><td
class="v">1024k</td></tr>

<tr><td class="e">realpath_cache_ttl</td><td class="v">600</td><td
class="v">600</td></tr>

------------------------------------------------------------------------
[2010-07-13 00:47:13] v dot damore at gmail dot com

I have executed script:



<pre>

<?php

var_dump(realpath_cache_get());

?>

</pre>



[r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php

<pre>

array(0) {

}

</pre>

------------------------------------------------------------------------
[2010-07-13 00:38:32] v dot damore at gmail dot com

Please note, gdb output I sent is related to third time I have called
curl http://damorealt.xoom.it/test.php



I have set break point as requested:



(gdb) break realpath_cache_find

Breakpoint 1 at 0x2b0b3c9f254d: file
/usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c,
line 560.

(gdb) bt

#0  0x000000391760db00 in __accept_nocancel () from
/lib64/libpthread.so.0

#1  0x00002b0b3c1f4544 in apr_socket_accept () from
/usr/lib64/libapr-1.so.0

#2  0x00000000004562e5 in unixd_accept ()

#3  0x0000000000454006 in child_main ()

#4  0x000000000045416c in make_child ()

#5  0x0000000000454701 in ap_mpm_run ()

#6  0x00000000004220ef in main ()

(gdb) continue

Continuing.



During test call gdb as not broken execution.

Function realpath_cache_find is not called.

------------------------------------------------------------------------
[2010-07-13 00:33:12] ras...@php.net

Actually, try this simple test.php script:



<pre>

<?php

var_dump(realpath_cache_get());

?>

</pre>





That should tell you what is getting cached.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=52312


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

Reply via email to