svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/filter/filter.c branches/PHP_5_3/ext/filter/filter_private.h
branches/PHP_5_3/ext/filter/sanitizing_filters.c trunk/ext/filter/filter.c trunk/ext/filter/filter_private.h trunk/ext/filter/sanitizing_filters.c
| From: | Ilia Alshanetsky | Date: | Mon, 07 Dec 2009 13:43:44 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/filter/filter.c branches/PHP_5_3/ext/filter/filter_private.h branches/PHP_5_3/ext/filter/sanitizing_filters.c trunk/ext/filter/filter.c trunk/ext/filter/filter_private.h trunk/ext/filter/sanitizing_filters.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-61168@lists.php.net to get a copy of this message | ||
iliaa Mon, 07 Dec 2009 13:43:44 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291818
Log:
Added FILTER_FLAG_STRIP_BACKTICK option to the filter extension.
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/filter/filter.c
U php/php-src/branches/PHP_5_3/ext/filter/filter_private.h
U php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c
U php/php-src/trunk/ext/filter/filter.c
U php/php-src/trunk/ext/filter/filter_private.h
U php/php-src/trunk/ext/filter/sanitizing_filters.c
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-12-07 13:43:44 UTC (rev 291818)
@@ -9,6 +9,7 @@
- Changed "post_max_size" php.ini directive to allow unlimited post size by
setting it to 0. (Rasmus)
+- Added FILTER_FLAG_STRIP_BACKTICK option to the filter extension. (Ilia)
- Added protection for $_SESSION from interrupt corruption and improved
"session.save_path" check. (Stas)
- Added LIBXML_PARSEHUGE constant to override the maximum text size of a
Modified: php/php-src/branches/PHP_5_3/ext/filter/filter.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/filter.c 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/branches/PHP_5_3/ext/filter/filter.c 2009-12-07 13:43:44 UTC (rev 291818)
@@ -251,6 +251,7 @@
REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS |
CONST_PERSISTENT);
Modified: php/php-src/branches/PHP_5_3/ext/filter/filter_private.h
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/filter_private.h 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/branches/PHP_5_3/ext/filter/filter_private.h 2009-12-07 13:43:44 UTC (rev 291818)
@@ -39,6 +39,7 @@
#define FILTER_FLAG_ENCODE_AMP 0x0040
#define FILTER_FLAG_NO_ENCODE_QUOTES 0x0080
#define FILTER_FLAG_EMPTY_STRING_NULL 0x0100
+#define FILTER_FLAG_STRIP_BACKTICK 0x0200
#define FILTER_FLAG_ALLOW_FRACTION 0x1000
#define FILTER_FLAG_ALLOW_THOUSAND 0x2000
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 2009-12-07 12:42:00 UTC (rev
291817)
+++ php/php-src/branches/PHP_5_3/ext/filter/sanitizing_filters.c 2009-12-07 13:43:44 UTC (rev
291818)
@@ -123,6 +123,7 @@
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
} else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
+ } else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) {
} else {
buf[c] = str[i];
++c;
Modified: php/php-src/trunk/ext/filter/filter.c
===================================================================
--- php/php-src/trunk/ext/filter/filter.c 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/trunk/ext/filter/filter.c 2009-12-07 13:43:44 UTC (rev 291818)
@@ -251,6 +251,7 @@
REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS |
CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK,
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS |
CONST_PERSISTENT);
Modified: php/php-src/trunk/ext/filter/filter_private.h
===================================================================
--- php/php-src/trunk/ext/filter/filter_private.h 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/trunk/ext/filter/filter_private.h 2009-12-07 13:43:44 UTC (rev 291818)
@@ -39,6 +39,7 @@
#define FILTER_FLAG_ENCODE_AMP 0x0040
#define FILTER_FLAG_NO_ENCODE_QUOTES 0x0080
#define FILTER_FLAG_EMPTY_STRING_NULL 0x0100
+#define FILTER_FLAG_STRIP_BACKTICK 0x0200
#define FILTER_FLAG_ALLOW_FRACTION 0x1000
#define FILTER_FLAG_ALLOW_THOUSAND 0x2000
Modified: php/php-src/trunk/ext/filter/sanitizing_filters.c
===================================================================
--- php/php-src/trunk/ext/filter/sanitizing_filters.c 2009-12-07 12:42:00 UTC (rev 291817)
+++ php/php-src/trunk/ext/filter/sanitizing_filters.c 2009-12-07 13:43:44 UTC (rev 291818)
@@ -123,6 +123,7 @@
for (i = 0; i < Z_STRLEN_P(value); i++) {
if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
} else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
+ } else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) {
} else {
buf[c] = str[i];
++c;