svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/filter/sanitizing_filters.c branches/PHP_5_3/ext/filter/tests/bug53037.phpt
trunk/ext/filter/sanitizing_filters.c trunk/ext/filter/tests/bug53037.phpt
| From: | Ilia Alshanetsky | Date: | Sun, 03 Apr 2011 16:30:31 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/filter/sanitizing_filters.c branches/PHP_5_3/ext/filter/tests/bug53037.phpt trunk/ext/filter/sanitizing_filters.c trunk/ext/filter/tests/bug53037.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-64790@lists.php.net to get a copy of this message | ||
iliaa Sun, 03 Apr 2011 16:30:31 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=309920
Log:
Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented).
Bug: http://bugs.php.net/53037 (Open) activate
FILTER_FLAG_EMPTY_STRING_NULL
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c
A php/php-src/branches/PHP_5_3/ext/filter/tests/bug53037.phpt
U php/php-src/trunk/ext/filter/sanitizing_filters.c
A php/php-src/trunk/ext/filter/tests/bug53037.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2011-04-03 12:25:43 UTC (rev 309919)
+++ php/php-src/branches/PHP_5_3/NEWS 2011-04-03 16:30:31 UTC (rev 309920)
@@ -28,6 +28,9 @@
- DBA extension:
. Fixed bug #54242 (dba_insert returns true if key already exists). (Felipe)
+- Filter extension:
+ . Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented). (Ilia)
+
- LDAP extension:
. Fixed bug #53339 (Fails to build when compilng with gcc 4.5 and DSO
libraries). (Clint Byrum, Raphael)
Modified: php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c 2011-04-03 12:25:43 UTC (rev
309919)
+++ php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c 2011-04-03 16:30:31 UTC (rev
309920)
@@ -205,7 +205,11 @@
if (new_len == 0) {
zval_dtor(value);
- ZVAL_EMPTY_STRING(value);
+ if (flags & FILTER_FLAG_EMPTY_STRING_NULL) {
+ ZVAL_NULL(value);
+ } else {
+ ZVAL_EMPTY_STRING(value);
+ }
return;
}
}
@@ -280,6 +284,9 @@
}
php_filter_encode_html(value, enc);
+ } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) {
+ zval_dtor(value);
+ ZVAL_NULL(value);
}
}
/* }}} */
Added: php/php-src/branches/PHP_5_3/ext/filter/tests/bug53037.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/tests/bug53037.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/filter/tests/bug53037.phpt 2011-04-03 16:30:31 UTC (rev 309920)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented)
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(
+ filter_var("", FILTER_DEFAULT),
+ filter_var("", FILTER_DEFAULT, array('flags' =>
FILTER_FLAG_EMPTY_STRING_NULL))
+);
+?>
+--EXPECT--
+string(0) ""
+NULL
Modified: php/php-src/trunk/ext/filter/sanitizing_filters.c
===================================================================
--- php/php-src/trunk/ext/filter/sanitizing_filters.c 2011-04-03 12:25:43 UTC (rev 309919)
+++ php/php-src/trunk/ext/filter/sanitizing_filters.c 2011-04-03 16:30:31 UTC (rev 309920)
@@ -205,7 +205,11 @@
if (new_len == 0) {
zval_dtor(value);
- ZVAL_EMPTY_STRING(value);
+ if (flags & FILTER_FLAG_EMPTY_STRING_NULL) {
+ ZVAL_NULL(value);
+ } else {
+ ZVAL_EMPTY_STRING(value);
+ }
return;
}
}
@@ -280,6 +284,9 @@
}
php_filter_encode_html(value, enc);
+ } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) {
+ zval_dtor(value);
+ ZVAL_NULL(value);
}
}
/* }}} */
Added: php/php-src/trunk/ext/filter/tests/bug53037.phpt
===================================================================
--- php/php-src/trunk/ext/filter/tests/bug53037.phpt (rev 0)
+++ php/php-src/trunk/ext/filter/tests/bug53037.phpt 2011-04-03 16:30:31 UTC (rev 309920)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented)
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(
+ filter_var("", FILTER_DEFAULT),
+ filter_var("", FILTER_DEFAULT, array('flags' =>
FILTER_FLAG_EMPTY_STRING_NULL))
+);
+?>
+--EXPECT--
+string(0) ""
+NULL