rasmus Wed May 10 21:25:01 2006 UTC
Modified files:
/php-src/main SAPI.c
/php-src/sapi/apache mod_php5.c
Log:
MFB input filter hook for getenv()
http://cvs.php.net/viewcvs.cgi/php-src/main/SAPI.c?r1=1.213&r2=1.214&diff_format=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.213 php-src/main/SAPI.c:1.214
--- php-src/main/SAPI.c:1.213 Fri Mar 24 00:25:49 2006
+++ php-src/main/SAPI.c Wed May 10 21:25:01 2006
@@ -18,13 +18,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.213 2006/03/24 00:25:49 andrei Exp $ */
+/* $Id: SAPI.c,v 1.214 2006/05/10 21:25:01 rasmus Exp $ */
#include <ctype.h>
#include <sys/stat.h>
#include "php.h"
#include "SAPI.h"
+#include "php_variables.h"
#include "php_ini.h"
#include "ext/standard/php_string.h"
#include "ext/standard/pageinfo.h"
@@ -876,11 +877,15 @@
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
{
- if (sapi_module.getenv) {
- return sapi_module.getenv(name, name_len TSRMLS_CC);
+ if (sapi_module.getenv) {
+ char *value, *tmp = sapi_module.getenv(name, name_len
TSRMLS_CC);
+ if(tmp) value = estrdup(tmp);
+ else return NULL;
+ sapi_module.input_filter(PARSE_ENV, name, &value,
strlen(value), NULL TSRMLS_CC);
+ return value;
} else {
- return NULL;
- }
+ return NULL;
+ }
}
SAPI_API int sapi_get_fd(int *fd TSRMLS_DC)
http://cvs.php.net/viewcvs.cgi/php-src/sapi/apache/mod_php5.c?r1=1.31&r2=1.32&diff_format=u
Index: php-src/sapi/apache/mod_php5.c
diff -u php-src/sapi/apache/mod_php5.c:1.31 php-src/sapi/apache/mod_php5.c:1.32
--- php-src/sapi/apache/mod_php5.c:1.31 Sun Apr 2 17:58:06 2006
+++ php-src/sapi/apache/mod_php5.c Wed May 10 21:25:01 2006
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.31 2006/04/02 17:58:06 iliaa Exp $ */
+/* $Id: mod_php5.c,v 1.32 2006/05/10 21:25:01 rasmus Exp $ */
#include "php_apache_http.h"
#include "http_conf_globals.h"
@@ -250,13 +250,17 @@
for (i = 0; i < arr->nelts; i++) {
char *val;
+ int val_len, new_val_len;
if (elts[i].val) {
val = elts[i].val;
} else {
val = "";
}
- php_register_variable(elts[i].key, val, track_vars_array
TSRMLS_CC);
+ val_len = strlen(val);
+ if (sapi_module.input_filter(PARSE_SERVER, elts[i].key, &val,
val_len, &new_val_len TSRMLS_CC)) {
+ php_register_variable_safe(elts[i].key, val,
new_val_len, track_vars_array TSRMLS_CC);
+ }
}
/* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php