iliaa Sat Dec 9 14:14:29 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/filter/tests 041.phpt
Modified files:
/php-src/ext/filter filter.c
/php-src run-tests.php
Log:
Fixed handling of multiple cookies with the same name.
Added support for cookies into run-tests.php
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.52.2.35&r2=1.52.2.36&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.52.2.35
php-src/ext/filter/filter.c:1.52.2.36
--- php-src/ext/filter/filter.c:1.52.2.35 Fri Dec 8 17:50:04 2006
+++ php-src/ext/filter/filter.c Sat Dec 9 14:14:29 2006
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.52.2.35 2006/12/08 17:50:04 iliaa Exp $ */
+/* $Id: filter.c,v 1.52.2.36 2006/12/09 14:14:29 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -275,7 +275,7 @@
{
php_info_print_table_start();
php_info_print_table_row( 2, "Input Validation and Filtering",
"enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.35 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.36 $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -370,6 +370,16 @@
break;
}
+ /*
+ * According to rfc2965, more specific paths are listed above the less
specific ones.
+ * If we encounter a duplicate cookie name, we should skip it, since it
is not possible
+ * to have the same (plain text) cookie name for the same path and we
should not overwrite
+ * more specific cookies with the less specific ones.
+ */
+ if (arg == PARSE_COOKIE && orig_array_ptr &&
zend_symtable_exists(Z_ARRVAL_P(orig_array_ptr), var, strlen(var)+1)) {
+ return 0;
+ }
+
if (array_ptr) {
/* Make a copy of the variable name, as
php_register_variable_ex seems to
* modify it */
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.226.2.37.2.18&r2=1.226.2.37.2.19&diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.37.2.18
php-src/run-tests.php:1.226.2.37.2.19
--- php-src/run-tests.php:1.226.2.37.2.18 Mon Dec 4 13:07:26 2006
+++ php-src/run-tests.php Sat Dec 9 14:14:29 2006
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: run-tests.php,v 1.226.2.37.2.18 2006/12/04 13:07:26 tony2001 Exp $ */
+/* $Id: run-tests.php,v 1.226.2.37.2.19 2006/12/09 14:14:29 iliaa Exp $ */
/* Sanity check to ensure that pcre extension needed by this script is
available.
* In the event it is not, print a nice error message indicating that this
script will
@@ -397,7 +397,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
- echo '$Revision: 1.226.2.37.2.18
$'."\n";
+ echo '$Revision: 1.226.2.37.2.19
$'."\n";
exit(1);
default:
echo "Illegal switch '$switch'
specified!\n";
@@ -950,13 +950,14 @@
'TEST' => '',
'SKIPIF' => '',
'GET' => '',
+ 'COOKIE' => '',
'POST_RAW' => '',
'POST' => '',
'UPLOAD' => '',
'ARGS' => '',
);
- $fp = @fopen($file, "rt") or error("Cannot open test file: $file");
+ $fp = fopen($file, "rt") or error("Cannot open test file: $file");
$borked = false;
$bork_info = '';
@@ -1039,7 +1040,7 @@
$tested = trim($section_text['TEST']);
/* For GET/POST tests, check if cgi sapi is available and if it is, use
it. */
- if (!empty($section_text['GET']) || !empty($section_text['POST']) ||
!empty($section_text['POST_RAW'])) {
+ if (!empty($section_text['GET']) || !empty($section_text['POST']) ||
!empty($section_text['POST_RAW']) || !empty($section_text['COOKIE'])) {
if (isset($php_cgi)) {
$old_php = $php;
$php = $php_cgi .' -C ';
@@ -1288,6 +1289,12 @@
$env['PATH_TRANSLATED'] = $test_file;
$env['SCRIPT_FILENAME'] = $test_file;
+ if (array_key_exists('COOKIE', $section_text)) {
+ $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
+ } else {
+ $env['HTTP_COOKIE'] = '';
+ }
+
$args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : '';
if (array_key_exists('POST_RAW', $section_text) &&
!empty($section_text['POST_RAW'])) {
@@ -1347,6 +1354,7 @@
REDIRECT_STATUS = " . $env['REDIRECT_STATUS'] . "
REQUEST_METHOD = " . $env['REQUEST_METHOD'] . "
SCRIPT_FILENAME = " . $env['SCRIPT_FILENAME'] . "
+HTTP_COOKIE = " . $env['HTTP_COOKIE'] . "
COMMAND $cmd
";
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/041.phpt?view=markup&rev=1.1
Index: php-src/ext/filter/tests/041.phpt
+++ php-src/ext/filter/tests/041.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php