ID:               50159
 Updated by:       srina...@php.net
 Reported By:      cwei...@php.net
-Status:           Open
+Status:           Feedback
 Bug Type:         *General Issues
 Operating System: *
 PHP Version:      5.3.1RC3
 New Comment:

hi,
 in my quick investigation, i think the issue is we are doing chdir to

the absolute path of given uri (which is a change in behavior compared

to 5.2).

here is a rough draft like patch that seems to alleviate this problem.

[srir...@tim-vm2]'PHP_5_3'>svn diff main/fopen_wrappers.c 
Index: main/fopen_wrappers.c
===================================================================
--- main/fopen_wrappers.c       (revision 290898)
+++ main/fopen_wrappers.c       (working copy)
@@ -386,7 +386,7 @@
 #ifndef PHP_WIN32
        struct stat st;
 #endif
-       char *path_info, *filename;
+       char *path_info, *filename, *orig_filename;
        int length;
 
        filename = SG(request_info).path_translated;
@@ -455,6 +455,7 @@
        } /* if doc_root && path_info */
 
        if (filename) {
+               orig_filename = estrdup(filename);
                filename = zend_resolve_path(filename, 
strlen(filename) TSRMLS_CC);
        }
 
@@ -488,8 +489,15 @@
        STR_FREE(SG(request_info).path_translated);     /* for same 
reason as above */
        SG(request_info).path_translated = filename;
 
-       file_handle->filename = SG(request_info).path_translated;
-       file_handle->free_filename = 0;
+       if (orig_filename) {
+               file_handle->filename = orig_filename;
+               file_handle->free_filename = 1;
+       }
+       else {
+               file_handle->filename = 
SG(request_info).path_translated;
+               file_handle->free_filename = 0;
+       }
+
        file_handle->handle.fp = fp;
        file_handle->type = ZEND_HANDLE_FP;
 

applying this patch , seems to work. af course, more thought need to 
go on this before this can be committed. 





Previous Comments:
------------------------------------------------------------------------

[2009-11-13 08:36:53] j...@php.net

So no need to ask Dmitry then. :)

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

[2009-11-12 22:24:59] cwei...@php.net

I reverted
<@Jani_> svn diff -r263054:263055
with patch -R, but that did not help. I still get the symlink directory
reported when running <?php echo getcwd(); ?>

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

[2009-11-12 17:02:06] j...@php.net

Dmitry, I think this patch of yours caused this:

http://svn.php.net/viewvc?view=revision&revision=263055

Any comments?

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

[2009-11-12 16:44:52] j...@php.net

See also bug #46814 (reported for 5.2.8 actually..)

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

[2009-11-12 16:44:40] cwei...@php.net

sapi is fastcgi

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

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/50159

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

Reply via email to