hi Ilia, Thanks for the fix!
Can you add the test as well please? Cheers, On Sun, Jan 3, 2010 at 11:58 PM, Ilia Alshanetsky <il...@php.net> wrote: > iliaa Sun, 03 Jan 2010 22:58:37 +0000 > > Revision: http://svn.php.net/viewvc?view=revision&revision=293051 > > Log: > Fixed bug #50632 (filter_input() does not return default value if the > variable does not exist) > > Bug: http://bugs.php.net/50632 (Open) Return default value if var is undefined > > Changed paths: > U php/php-src/branches/PHP_5_2/NEWS > U php/php-src/branches/PHP_5_2/ext/filter/filter.c > 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/trunk/ext/filter/filter.c > > Modified: php/php-src/branches/PHP_5_2/NEWS > =================================================================== > --- php/php-src/branches/PHP_5_2/NEWS 2010-01-03 22:14:04 UTC (rev 293050) > +++ php/php-src/branches/PHP_5_2/NEWS 2010-01-03 22:58:37 UTC (rev 293051) > @@ -13,6 +13,8 @@ > > - Fixed bug #50636 (MySQLi_Result sets values before calling constructor). > (Pierrick) > +- Fixed bug #50632 (filter_input() does not return default value if the > + variable does not exist). (Ilia) > - Fixed bug #50575 (PDO_PGSQL LOBs are not compatible with PostgreSQL 8.5). > (Matteo) > - Fixed bug #50558 (Broken object model when extending tidy). (Pierrick) > > Modified: php/php-src/branches/PHP_5_2/ext/filter/filter.c > =================================================================== > --- php/php-src/branches/PHP_5_2/ext/filter/filter.c 2010-01-03 22:14:04 > UTC (rev 293050) > +++ php/php-src/branches/PHP_5_2/ext/filter/filter.c 2010-01-03 22:58:37 > UTC (rev 293051) > @@ -728,7 +728,8 @@ > filter_flags = Z_LVAL_PP(filter_args); > } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), "flags", sizeof("flags"), (void > **)&option) == SUCCESS) { > PHP_FILTER_GET_LONG_OPT(option, filter_flags); > - } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > + } > + if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), > "options", sizeof("options"), (void **)&opt) == SUCCESS && > Z_TYPE_PP(opt) == IS_ARRAY && > zend_hash_find(HASH_OF(*opt), "default", > sizeof("default"), (void **)&def) == SUCCESS > > Modified: php/php-src/branches/PHP_5_3/NEWS > =================================================================== > --- php/php-src/branches/PHP_5_3/NEWS 2010-01-03 22:14:04 UTC (rev 293050) > +++ php/php-src/branches/PHP_5_3/NEWS 2010-01-03 22:58:37 UTC (rev 293051) > @@ -9,6 +9,8 @@ > > - Fixed bug #50636 (MySQLi_Result sets values before calling constructor). > (Pierrick) > +- Fixed bug #50632 (filter_input() does not return default value if the > + variable does not exist). (Ilia) > - Fixed bug #48190 (Content-type parameter "boundary" is not case-insensitive > in HTTP uploads). (Ilia) > - Fixed bug #47409 (extract() problem with array containing word "this"). > > Modified: php/php-src/branches/PHP_5_3/ext/filter/filter.c > =================================================================== > --- php/php-src/branches/PHP_5_3/ext/filter/filter.c 2010-01-03 22:14:04 > UTC (rev 293050) > +++ php/php-src/branches/PHP_5_3/ext/filter/filter.c 2010-01-03 22:58:37 > UTC (rev 293051) > @@ -768,7 +768,8 @@ > filter_flags = Z_LVAL_PP(filter_args); > } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), "flags", sizeof("flags"), (void > **)&option) == SUCCESS) { > PHP_FILTER_GET_LONG_OPT(option, filter_flags); > - } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > + } > + if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), > "options", sizeof("options"), (void **)&opt) == SUCCESS && > Z_TYPE_PP(opt) == IS_ARRAY && > zend_hash_find(HASH_OF(*opt), "default", > sizeof("default"), (void **)&def) == SUCCESS > > Modified: php/php-src/trunk/ext/filter/filter.c > =================================================================== > --- php/php-src/trunk/ext/filter/filter.c 2010-01-03 22:14:04 UTC (rev > 293050) > +++ php/php-src/trunk/ext/filter/filter.c 2010-01-03 22:58:37 UTC (rev > 293051) > @@ -781,7 +781,8 @@ > filter_flags = Z_LVAL_PP(filter_args); > } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), "flags", sizeof("flags"), (void > **)&option) == SUCCESS) { > PHP_FILTER_GET_LONG_OPT(option, filter_flags); > - } else if (Z_TYPE_PP(filter_args) == IS_ARRAY && > + } > + if (Z_TYPE_PP(filter_args) == IS_ARRAY && > zend_hash_find(HASH_OF(*filter_args), > "options", sizeof("options"), (void **)&opt) == SUCCESS && > Z_TYPE_PP(opt) == IS_ARRAY && > zend_hash_find(HASH_OF(*opt), "default", > sizeof("default"), (void **)&def) == SUCCESS > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php