cvs: php-src(PHP_5_2) /ext/filter filter.c
| From: | Jani Taskinen | Date: | Wed, 06 Feb 2008 19:07:36 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/filter filter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-48385@lists.php.net to get a copy of this message | ||
jani Wed Feb 6 19:07:36 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/filter filter.c
Log:
MFH:- Fixed bug in handling arrays which caused the original array being modified too.
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/filter.c?r1=1.52.2.40&r2=1.52.2.41&diff_format=u
Index: php-src/ext/filter/filter.c
diff -u php-src/ext/filter/filter.c:1.52.2.40 php-src/ext/filter/filter.c:1.52.2.41
--- php-src/ext/filter/filter.c:1.52.2.40 Mon Dec 31 07:20:06 2007
+++ php-src/ext/filter/filter.c Wed Feb 6 19:07:36 2008
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.52.2.40 2007/12/31 07:20:06 sebastian Exp $ */
+/* $Id: filter.c,v 1.52.2.41 2008/02/06 19:07:36 jani 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.40 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.41 $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -453,15 +453,16 @@
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(value), (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)) {
-
- if (Z_TYPE_PP(element) == IS_ARRAY) {
- Z_ARRVAL_PP(element)->nApplyCount++;
- php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
- Z_ARRVAL_PP(element)->nApplyCount--;
- } else {
- php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
- }
+ zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)
+ ) {
+ SEPARATE_ZVAL_IF_NOT_REF(element);
+ if (Z_TYPE_PP(element) == IS_ARRAY) {
+ Z_ARRVAL_PP(element)->nApplyCount++;
+ php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
+ Z_ARRVAL_PP(element)->nApplyCount--;
+ } else {
+ php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
+ }
}
} else {
php_zval_filter(value, filter, flags, options, charset, copy TSRMLS_CC);