ptr = end;
}
php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, pathbuf);
+ "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir));
efree(pathbuf);
errno = EPERM; /* we deny permission to open it */
return -1;
end++;
}
snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
+
+ /* If file does not exist continue */
+ if (VCWD_STAT(trypath, &sb) != 0) {
+ ptr = end;
+ continue;
+ }
if (php_check_open_basedir(trypath TSRMLS_CC)) {
stream = NULL;
}
if (PG(safe_mode)) {
- if (VCWD_STAT(trypath, &sb) == 0) {
- /* file exists ... check permission */
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
- php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM)) {
- /* UID ok, or trypath is in safe_mode_include_dir */
- stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
- } else {
- stream = NULL;
- }
- goto stream_done;
+ /* file exists ... check permission */
+ if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
+ php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM)) {
+ /* UID ok, or trypath is in safe_mode_include_dir */
+ stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
+ } else {
+ stream = NULL;
}
+ goto stream_done;
}
stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
if (stream) {