rasmus Wed May 10 21:19:32 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/main SAPI.c
/php-src/sapi/apache mod_php5.c
Log:
Add input_filter hook call in getenv()
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.547.2.12&r2=1.2027.2.547.2.13&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.12 php-src/NEWS:1.2027.2.547.2.13
--- php-src/NEWS:1.2027.2.547.2.12 Wed May 10 19:20:34 2006
+++ php-src/NEWS Wed May 10 21:19:32 2006
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2006, PHP 5.2.0
+- Added support for getenv() input filtering. (Rasmus)
- Removed ze1 compatibility mode. (Marcus)
- Added support for constructors in interfaces to force constructor signature
checks in implementations. (Marcus)
http://cvs.php.net/viewcvs.cgi/php-src/main/SAPI.c?r1=1.202.2.7&r2=1.202.2.7.2.1&diff_format=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.202.2.7 php-src/main/SAPI.c:1.202.2.7.2.1
--- php-src/main/SAPI.c:1.202.2.7 Sun Jan 1 12:50:17 2006
+++ php-src/main/SAPI.c Wed May 10 21:19:32 2006
@@ -18,13 +18,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.202.2.7 2006/01/01 12:50:17 sniper Exp $ */
+/* $Id: SAPI.c,v 1.202.2.7.2.1 2006/05/10 21:19:32 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"
@@ -914,11 +915,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.19.2.7&r2=1.19.2.7.2.1&diff_format=u
Index: php-src/sapi/apache/mod_php5.c
diff -u php-src/sapi/apache/mod_php5.c:1.19.2.7
php-src/sapi/apache/mod_php5.c:1.19.2.7.2.1
--- php-src/sapi/apache/mod_php5.c:1.19.2.7 Sun Apr 2 17:58:17 2006
+++ php-src/sapi/apache/mod_php5.c Wed May 10 21:19:32 2006
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.19.2.7 2006/04/02 17:58:17 iliaa Exp $ */
+/* $Id: mod_php5.c,v 1.19.2.7.2.1 2006/05/10 21:19:32 rasmus Exp $ */
#include "php_apache_http.h"
#include "http_conf_globals.h"
@@ -254,13 +254,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