The attached patch fixes <http://bugs.php.net/bug.php?id=17858> by
implementing the necessary php_apache_sapi_get_stat function. As I wrote
in the comment, it does one more system call than is strictly necessary
and won't help in cases where the request does not originate from a
file. It's a pretty clear improvement over the current situation, though.
--
Scott Lamb
Index: sapi/apache2filter/sapi_apache2.c
===================================================================
RCS file: /repository/php4/sapi/apache2filter/sapi_apache2.c,v
retrieving revision 1.81
diff -u -r1.81 sapi_apache2.c
--- sapi/apache2filter/sapi_apache2.c 28 Jun 2002 14:45:10 -0000 1.81
+++ sapi/apache2filter/sapi_apache2.c 19 Jul 2002 03:50:38 -0000
@@ -208,6 +208,18 @@
}
}
+static struct stat *php_apache_sapi_get_stat(TSRMLS_D)
+{
+ request_rec *rec;
+ rec = ((php_struct*)SG(server_context))->r;
+ if (stat(rec->canonical_filename, &SG(global_stat)) != 0) {
+ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP,
+ 0, NULL, "Can't stat \"%s\"",
+rec->canonical_filename);
+ return NULL;
+ }
+ return &SG(global_stat);
+}
+
static void php_apache_sapi_log_message(char *msg)
{
php_struct *ctx;
@@ -242,7 +254,7 @@
php_apache_sapi_ub_write, /* unbuffered write */
php_apache_sapi_flush, /* flush */
- NULL, /* get
uid */
+ php_apache_sapi_get_stat, /* get uid */
NULL, /*
getenv */
php_error, /*
error handler */
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php