ID:               41822
 Updated by:       [EMAIL PROTECTED]
-Reported By:      ian at onlineloop dot com
+Reported By:      [EMAIL PROTECTED]
-Status:           Assigned
+Status:           Closed
 Bug Type:         *Directory/Filesystem functions
 Operating System: Solaris 10
 PHP Version:      5.2CVS-20070627
-Assigned To:      tony2001
+Assigned To:      ab5602
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

This is fixed in CVS.


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

[2007-10-05 22:01:31] ab5602 at wayne dot edu

I created the following patch which fixes the problem, however it still
needs discussion as to if it is a good way to implement this fix.  At
least it can serve as a starting point.  One concern was if this should
be implemented at a lower level (TSRM code).

--- ./plain_wrapper.c.old       2007-10-05 02:50:59.000000000 -0400
+++ ./plain_wrapper.c   2007-10-05 02:55:38.000000000 -0400
@@ -885,9 +885,20 @@
                return NULL;
        }

-       if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) ==
NULL) {
-               return NULL;
-       }
+        if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) ==
NULL)
+                {
+                if (options & STREAM_OPEN_FOR_INCLUDE) {
+                        /* Attempt to open without path expansion
anyways.
+                           Files in Solaris dirs with --x will
+                           not return a realpath, but are accessible
*/
+                        fd = open(filename, open_flags, 0666);
+                        if (fd != -1) {
+                                ret =
php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id);
+                                return ret; }
+                        else {
+                                return NULL; }
+                        }
+                }

        if (persistent) {
                spprintf(&persistent_id, 0, "streams_stdio_%d_%s",
open_flags, realpath);

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

[2007-10-05 11:58:09] jh at webteam dot at

Could reproduce this bug under Mac OS X 10.4.10 and PHP 5.2.4 (via 
MacPorts).

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

[2007-10-05 03:29:44] ab5602 at wayne dot edu

No, the above NFS issues is a side-effect of:

1) Solaris getcwd() not functioning properly with (--x) directories

   and

2) PHP not properly allowing relative include()'s when #1 is the case

#2 is probably solvable w/ a bug fix, #1 is obviously not.

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

[2007-10-02 11:11:49] [EMAIL PROTECTED]

So this is only an issue with NFS shares? If so, please indicate that
in the summary.

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

[2007-10-02 06:54:42] ab5602 at wayne dot edu

I figured out what the issue was with the NFS shares and the
"permission denied error" in our Solaris environment.  It was related to
the same (--x) permission issue that you are having.

As it turns out, if you mount an NFS share in:

/mylocaldir/nfsmount/

The /nfsmount/ directory permissions, *before* you mount the share,
need to be (r-x) or better, even though these permissions are hidden
after the mount in order to avoid the Solaris+PHP include() bug.  Now
include() and getcwd() work just fine!

It is very clear that this all goes back to two options:

1) Either make all the subdirs underneath (r-x)
   
   OR

2) If it is possible (which I'm not yet sure of), the PHP binary needs
to "tell" Solaris that it already knows the current path by doing a
chdir(/absolute/path/) or the like before trying getcwd() in order to
make the "include() cause permission denied error" go away.

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

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

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

Reply via email to