primary file realpath change
| From: | Brian J. France | Date: | Fri, 10 Mar 2006 05:13:56 +0000 |
| Subject: | primary file realpath change | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-22317@lists.php.net to get a copy of this message | ||
Does anybody see a problem with this patch (which is currently against the 5.1.2 release)?
expand_filepath will eventual do a realpath, but it also uses the realpath cache before calling realpath. VCWD_REALPATH just maps directly to realpath and doesn't use the realpath cache so for every request you get a realpath call (and all the syscalls that go with it) on the primary file.
I think I need to pass TSRMLS_CC, but I am not sure.
Any problems committing it to PHP_5_1 and HEAD?
Brian
--- ../php-5.1.2.orig/main/main.c Sun Jan 1 04:50:17 2006+++ main/main.c Thu Mar 9 20:00:47 2006 @@ -1684,7 +1684,7 @@
char realfile[MAXPATHLEN];
int realfile_len;
int dummy = 1;
- if (VCWD_REALPATH(primary_file->filename, realfile)) {
+ if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) {
realfile_len = strlen(realfile);
zend_hash_add(&EG(included_files), realfile, realfile_len+1, (void *)&dummy, sizeof(int), NULL);
if (strncmp(realfile, primary_file-filename, realfile_len)) {