Hello, I see that in 4.3.4RC1 this bug is fixed. Can someone please give me a hint where to find the patch only for that one?
I investigated a little because some time ago I made a patch that solves the following problem. Explanation: When open_basedir is in effect the following operation fails because of open_basedir restriction which I think is wrong: fopen("path/exists/file_doesnt","w"); It should not fail, or maybe with EACCESS if appropriate. So my patch (attached) makes sure that realpath successfully resolves non-existent paths. It does so by checking errno after realpath call, and in case it is ENOENT, it ignores the error. Can anybody comment on this?
diff -Naur php-4.3.3-orig/TSRM/tsrm_virtual_cwd.c php-4.3.3/TSRM/tsrm_virtual_cwd.c --- php-4.3.3-orig/TSRM/tsrm_virtual_cwd.c 2003-07-28 20:35:34.000000000 +0200 +++ php-4.3.3/TSRM/tsrm_virtual_cwd.c 2003-09-25 17:08:27.000000000 +0200 @@ -307,10 +307,13 @@ * This can happen under solaris when a dir does not have read permissions * but *does* have execute permissions */ 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); - } + if (use_realpath) { + char *rc = realpath(path, resolved_path); + if ( rc || errno == ENOENT ) { + path = resolved_path; + path_length = strlen(path); + } + } } else { /* Concat current directory with relative path and then run realpath() on it */ char *tmp; char *ptr;
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php