mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- Commit patch which checks for an include file in the calling scripts'
current working directory if everything else fails (include_path). - Right now this also effects things like opening php.ini. It'll now always check in the current working directory for php.ini. I think this doesn't screw up todays behavior.
This commit is contained in:
parent
203ea6c51d
commit
4b54140a35
1 changed files with 32 additions and 1 deletions
|
@ -443,9 +443,40 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
|
||||||
}
|
}
|
||||||
ptr = end;
|
ptr = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
efree(pathbuf);
|
||||||
|
|
||||||
|
{
|
||||||
|
char *exec_fname;
|
||||||
|
int exec_fname_len;
|
||||||
|
char *filename_dir;
|
||||||
|
ELS_FETCH();
|
||||||
|
|
||||||
|
exec_fname = zend_get_executed_filename(ELS_C);
|
||||||
|
exec_fname_len = strlen(exec_fname);
|
||||||
|
|
||||||
|
pathbuf = (char *) emalloc(exec_fname_len+filename_length+1+1); /* Over allocate to save time */
|
||||||
|
memcpy(pathbuf, exec_fname, exec_fname_len+1);
|
||||||
|
|
||||||
|
while ((--exec_fname_len >= 0) && !IS_SLASH(pathbuf[exec_fname_len])) {
|
||||||
|
}
|
||||||
|
pathbuf[exec_fname_len] = DEFAULT_SLASH;
|
||||||
|
memcpy(&pathbuf[exec_fname_len+1], filename, filename_length+1);
|
||||||
|
|
||||||
|
fprintf(stderr,"Trying to open %s\n", pathbuf);
|
||||||
|
|
||||||
|
if (PG(safe_mode)) {
|
||||||
|
if (VCWD_STAT(pathbuf, &sb) == 0 && (!php_checkuid(pathbuf, mode, CHECKUID_CHECK_MODE_PARAM))) {
|
||||||
efree(pathbuf);
|
efree(pathbuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
fp = php_fopen_and_set_opened_path(pathbuf, mode, opened_path);
|
||||||
|
efree(pathbuf);
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
return NULL; /* Not really needed anymore */
|
||||||
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_fopen_url_wrapper
|
/* {{{ php_fopen_url_wrapper
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue