#21310 [Fbk->Opn]: no such file (paths)

2003-02-13 Thread czuma
 ID:   21310
 User updated by:  [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Solaris 8
 PHP Version:  4.3.0
 New Comment:

Should I apply this patch to the latest "Stable (4.3.x-dev)" version or
to 4.3.0 version?


Previous Comments:


[2003-02-13 03:24:25] [EMAIL PROTECTED]

Testing the patch should not be a problem if it fixes the problem you
already described...
Don't forget, you can always run a test server on another port for a
short while without affecting your main server.

Feedback means that we need to know if the proposed solution fixes it
for you.  Our access to Solaris is quite limited, so we rely on
feedback to tell us if things are working.

If you can't provide feedback, and we don't have a way of testing it
ourselves, then this report will just get suspended.



[2003-02-13 02:29:56] [EMAIL PROTECTED]

To: [EMAIL PROTECTED]

Perhaps I don't understand "Feedback" status. Do you expect more
information concerning bug or do you expect that users will test new
patches on production servers?

("Oxford dictionary": "feedback: return of part of the output of a
system to its source".)



[2003-02-12 14:19:34] [EMAIL PROTECTED]

Try the patch below.  Solaris has issues with getcwd() needing read
perms on directories (instead of just execute).  This patch lets PHP
open files even if it cannot get the cwd, or resolve the realpath() of
a file.

Index: TSRM/tsrm_virtual_cwd.c
===
RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v
retrieving revision 1.41
diff -u -b -u -r1.41 tsrm_virtual_cwd.c
--- TSRM/tsrm_virtual_cwd.c 6 Nov 2002 18:07:22 -   1.41
+++ TSRM/tsrm_virtual_cwd.c 12 Feb 2003 04:39:11 -
@@ -303,7 +303,7 @@
return (0);
 
 #if !defined(TSRM_WIN32) && !defined(NETWARE)
-   if (IS_ABSOLUTE_PATH(path, path_length)) {
+   if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1))
{
if (use_realpath && realpath(path, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
@@ -363,6 +363,7 @@
}
 
 
+  if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
while (ptr) {
ptr_length = strlen(ptr);
@@ -416,6 +417,11 @@
state->cwd[state->cwd_length+1] = '\0';
state->cwd_length++;
}
+  } else {
+   state->cwd = (char *) realloc(state->cwd, path_length+1);
+   memcpy(state->cwd, path, path_length+1);
+   state->cwd_length = path_length;
+  }
 
if (verify_path && verify_path(state)) {
CWD_STATE_FREE(state);
Index: main/main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.512.2.5
diff -u -b -u -r1.512.2.5 main.c
--- main/main.c 16 Dec 2002 15:44:06 -  1.512.2.5
+++ main/main.c 12 Feb 2003 04:39:12 -
@@ -1507,7 +1507,11 @@
 {
zend_file_handle *prepend_file_p, *append_file_p;
zend_file_handle prepend_file, append_file;
+#ifdef VIRTUAL_DIR
char *old_cwd;
+#else
+   int old_cwd_fd;
+#endif
char *old_primary_file_path = NULL;
int retval = 0;
 
@@ -1515,9 +1519,11 @@
if (php_handle_special_queries(TSRMLS_C)) {
return 0;
}
+#ifdef VIRTUAL_DIR
 #define OLD_CWD_SIZE 4096
old_cwd = do_alloca(OLD_CWD_SIZE);
old_cwd[0] = '\0';
+#endif
 
zend_try {
 #ifdef PHP_WIN32
@@ -1528,7 +1534,11 @@
 
if (primary_file->type == ZEND_HANDLE_FILENAME 
&& primary_file->filename) {
+#ifdef VIRTUAL_DIR
VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
+#else
+   old_cwd_fd = open(".", 0);
+#endif
VCWD_CHDIR_FILE(primary_file->filename);
}
 
@@ -1578,10 +1588,14 @@

} zend_end_try();
 
+#ifdef VIRTUAL_DIR
if (old_cwd[0] != '\0') {
VCWD_CHDIR(old_cwd);
}
free_alloca(old_cwd);
+#else
+   fchdir(old_cwd_fd);
+#endif
return retval;
 }
 /* }}} */
Index: main/safe_mode.c
===
RCS file: /repository/php4/main/safe_mode.c,v
retrieving revision 1.51
diff -u -b -u -r1.51 safe_mode.c
--- main/safe_mode.c6 Nov 2002 18:07:23 -   1.51
+++ main/safe_mode.c1

#21310 [Fbk->Opn]: no such file (paths)

2003-02-13 Thread czuma
 ID:   21310
 User updated by:  [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Solaris 8
 PHP Version:  4.3.0
 New Comment:

To: [EMAIL PROTECTED]

Perhaps I don't understand "Feedback" status. Do you expect more
information concerning bug or do you expect that users will test new
patches on production servers?

("Oxford dictionary": "feedback: return of part of the output of a
system to its source".)


Previous Comments:


[2003-02-12 14:19:34] [EMAIL PROTECTED]

Try the patch below.  Solaris has issues with getcwd() needing read
perms on directories (instead of just execute).  This patch lets PHP
open files even if it cannot get the cwd, or resolve the realpath() of
a file.

Index: TSRM/tsrm_virtual_cwd.c
===
RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v
retrieving revision 1.41
diff -u -b -u -r1.41 tsrm_virtual_cwd.c
--- TSRM/tsrm_virtual_cwd.c 6 Nov 2002 18:07:22 -   1.41
+++ TSRM/tsrm_virtual_cwd.c 12 Feb 2003 04:39:11 -
@@ -303,7 +303,7 @@
return (0);
 
 #if !defined(TSRM_WIN32) && !defined(NETWARE)
-   if (IS_ABSOLUTE_PATH(path, path_length)) {
+   if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1))
{
if (use_realpath && realpath(path, resolved_path)) {
path = resolved_path;
path_length = strlen(path);
@@ -363,6 +363,7 @@
}
 
 
+  if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
while (ptr) {
ptr_length = strlen(ptr);
@@ -416,6 +417,11 @@
state->cwd[state->cwd_length+1] = '\0';
state->cwd_length++;
}
+  } else {
+   state->cwd = (char *) realloc(state->cwd, path_length+1);
+   memcpy(state->cwd, path, path_length+1);
+   state->cwd_length = path_length;
+  }
 
if (verify_path && verify_path(state)) {
CWD_STATE_FREE(state);
Index: main/main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.512.2.5
diff -u -b -u -r1.512.2.5 main.c
--- main/main.c 16 Dec 2002 15:44:06 -  1.512.2.5
+++ main/main.c 12 Feb 2003 04:39:12 -
@@ -1507,7 +1507,11 @@
 {
zend_file_handle *prepend_file_p, *append_file_p;
zend_file_handle prepend_file, append_file;
+#ifdef VIRTUAL_DIR
char *old_cwd;
+#else
+   int old_cwd_fd;
+#endif
char *old_primary_file_path = NULL;
int retval = 0;
 
@@ -1515,9 +1519,11 @@
if (php_handle_special_queries(TSRMLS_C)) {
return 0;
}
+#ifdef VIRTUAL_DIR
 #define OLD_CWD_SIZE 4096
old_cwd = do_alloca(OLD_CWD_SIZE);
old_cwd[0] = '\0';
+#endif
 
zend_try {
 #ifdef PHP_WIN32
@@ -1528,7 +1534,11 @@
 
if (primary_file->type == ZEND_HANDLE_FILENAME 
&& primary_file->filename) {
+#ifdef VIRTUAL_DIR
VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
+#else
+   old_cwd_fd = open(".", 0);
+#endif
VCWD_CHDIR_FILE(primary_file->filename);
}
 
@@ -1578,10 +1588,14 @@

} zend_end_try();
 
+#ifdef VIRTUAL_DIR
if (old_cwd[0] != '\0') {
VCWD_CHDIR(old_cwd);
}
free_alloca(old_cwd);
+#else
+   fchdir(old_cwd_fd);
+#endif
return retval;
 }
 /* }}} */
Index: main/safe_mode.c
===
RCS file: /repository/php4/main/safe_mode.c,v
retrieving revision 1.51
diff -u -b -u -r1.51 safe_mode.c
--- main/safe_mode.c6 Nov 2002 18:07:23 -   1.51
+++ main/safe_mode.c12 Feb 2003 04:39:12 -
@@ -121,6 +121,8 @@
VCWD_REALPATH(filename, path);
*s = DEFAULT_SLASH;
} else {
+   path[0] = '.';
+   path[1] = '\0';
VCWD_GETCWD(path, sizeof(path));
}
} /* end CHECKUID_ALLOW_ONLY_DIR */




[2003-02-06 12:37:26] [EMAIL PROTECTED]

Have you checked ALL directories permissions (especially permission to
read for HTTP server) from / to directory with included file?



[2003-02-06 12:06:31] [EMAIL PROTECTED]

I've also experienced the same problem on Solaris 8, w/ PHP 4.3.0, but
haven't been able to 

#21310 [Fbk->Opn]: no such file (paths)

2003-01-17 Thread sniper
 ID:   21310
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Solaris 8
 PHP Version:  4.3.0
 New Comment:

oops..



Previous Comments:


[2003-01-17 10:41:19] [EMAIL PROTECTED]

[EMAIL PROTECTED]:
Instead of spamming the bugdb with your theories, *please* respond to
our requests for more information in your own bug report.
We need *facts* to be able to fix the problem, and so far you haven't
given us any.



[2003-01-17 10:21:26] [EMAIL PROTECTED]

I reported this same problem aka. (BUG) at Bug# 21674
I too was told this is not a bug. I just upgraded to 4.3.0 from 4.1.2.
This problem did not previously exist. I'm getting the exact same
messages. Why hasn't the tech group at php.net not recognized that this
is, in fact, a bug? Too many reported occurences and all seem related
to 4.3.0.

The issue is related to "include_path".

In my case, I have a file located at 
/home/sites/site2/web/IV/config.php

The above file contans the following lines:
include_once ('lang.php');
include ('extras.php'); 

I have another script located at 
/home/sites/site3/web/powerpage.php 
 -> which contains the following lines: < 
require_once ("/home/sites/site2/web/IV/config.php");
langtop();

At first I thought it was a permissions issue. But then I rechecked my
debug process and found the errors are still occuring. (Actually they
appeared with another script of was testing that does similar path
includes.)

Warning: main(lang.php) [function.main]: failed to create stream: No
such file or directory in /home/sites/site2/web/IV/config.php on line
97

Warning: main() [function.main]: Failed opening 'lang.php' for
inclusion (include_path='') in /home/sites/site2/web/IV/config.php on
line 97

Warning: main(extras.php) [function.main]: failed to create stream: No
such file or directory in /home/sites/site2/web/IV/config.php on line
98

Warning: main() [function.main]: Failed opening 'extras.php' for
inclusion (include_path='') in /home/sites/site2/web/IV/config.php on
line 98


This is my guess.  PHP 4.3.0 now incorporates Stream functionality to
allow for references such as https or ssl:

I think that somewhere in this functionality, there was introduced a
hard dependency on absolute file paths that have now negatively
impacted on include functions calls such that if the include does not
reference a file in the same exact path as the calling script, the
above referenced errors will return indicating a failure to create the
stream connection to the requested file.

Just a guess. Im not a php guru. But I do know common sense.
How can all of us who have been affected by this, fix this annoying
problem?

Is it an issue with the PHP.ini file?
Is it an issue with the build process?
Are we now required to use absolute paths for all required includes or
require functions.

Notice: in my case my require_once does not error because I have
referenced the absolute path.



[2003-01-16 05:38:45] [EMAIL PROTECTED]

Both files are located in the same directory.

In my humble opinion, the reason of the problem is, that PHP wants to
read directory with file being included.



[2003-01-15 15:51:57] [EMAIL PROTECTED]

What are the exact locations of both the script trying to include() and
the file being included?




[2003-01-15 05:00:08] [EMAIL PROTECTED]

phpinfo(): .:/usr/local/lib/php
  php.ini: include_path = ".:/usr/local/lib/php"



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

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




#21310 [Fbk->Opn]: no such file (paths)

2003-01-16 Thread czuma
 ID:   21310
 User updated by:  [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Solaris 8
 PHP Version:  4.3.0
 New Comment:

Both files are located in the same directory.

In my humble opinion, the reason of the problem is, that PHP wants to
read directory with file being included.


Previous Comments:


[2003-01-15 15:51:57] [EMAIL PROTECTED]

What are the exact locations of both the script trying to include() and
the file being included?




[2003-01-15 05:00:08] [EMAIL PROTECTED]

phpinfo(): .:/usr/local/lib/php
  php.ini: include_path = ".:/usr/local/lib/php"



[2003-01-15 03:18:37] [EMAIL PROTECTED]

What does phpinfo() output for include_path?
What is include_path set to in your php.ini file?




[2003-01-10 08:18:46] [EMAIL PROTECTED]

I also think it is a bugg.

On ours servers all directories have only eXecute access to other.

Give read access to other on all level is realy a problem.

Cordialy.



[2003-01-06 12:02:18] [EMAIL PROTECTED]

yes, same thing for me.

if HTTP server has permission to read all directories in path to the
file, all users can read directories of other user and it's really not
secure ...



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

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




#21310 [Fbk->Opn]: no such file (paths)

2003-01-15 Thread czuma
 ID:   21310
 User updated by:  [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   Open
 Bug Type: *Directory/Filesystem functions
 Operating System: Solaris 8
 PHP Version:  4.3.0
 New Comment:

phpinfo(): .:/usr/local/lib/php
  php.ini: include_path = ".:/usr/local/lib/php"


Previous Comments:


[2003-01-15 03:18:37] [EMAIL PROTECTED]

What does phpinfo() output for include_path?
What is include_path set to in your php.ini file?




[2003-01-10 08:18:46] [EMAIL PROTECTED]

I also think it is a bugg.

On ours servers all directories have only eXecute access to other.

Give read access to other on all level is realy a problem.

Cordialy.



[2003-01-06 12:02:18] [EMAIL PROTECTED]

yes, same thing for me.

if HTTP server has permission to read all directories in path to the
file, all users can read directories of other user and it's really not
secure ...



[2003-01-05 16:59:45] [EMAIL PROTECTED]

In my humble opinion it is a bug, because:

1. Previous version of PHP (4.0) could read file without full path,
even if PHP couldnt read "." or higher directory.

2. PHP reads several directories (why?) when includes each file without
full path.

2. There is no technical reason to give PHP access to read all
directories from "/" to directories with PHP scripts.



[2003-01-05 16:41:43] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php





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

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