zval_copy_ctor(return_value); /* Watch out for empty strings */
php_zval_filter_recursive(return_value, filter, filter_flags, options, charset TSRMLS_CC);
} else {
- RETVAL_FALSE;
+ RETURN_NULL();
}
}
/* }}} */
php_zval_filter(*tmp, filter, filter_flags, options, charset TSRMLS_CC);
}
- if (Z_TYPE_PP(tmp) == IS_NULL) {
- add_assoc_bool(return_value, key, 0);
- } else {
- add_assoc_zval(return_value, key, *tmp);
- }
+ add_assoc_zval(return_value, key, *tmp);
} else {
add_assoc_null(return_value, key);
}
<license>PHP</license>
<release>
<state>beta</state>
- <version>0.9.5</version>
- <date>2006-05-01</date>
+ <version>0.10.0</version>
+ <date>2006-05-14</date>
<notes>- Fixed PECL bug #6136, ini_set should not be able to change the filter.default (Pierre)
- Fixed PECL bug #6639: uppercase hexadecimal digits are not supported
- Implemented PECL req #6641: negative values for hexadecimal and octal numbers are not supported.
- Added support for php pcre expressions (Pierre)
-- Fixed invalid error in pcre related validation (Pierre)
-- Fixed possible leak in internal sapi_filter (Pierre)
+- Fixed Possible leak in internal sapi_filter (Pierre)
- Added input_get_args, fetches all input in one call (Pierre)
- Added FILTER_FLAG_SCALAR and FILTER_FLAG_ARRAY , allows or not array values (Pierre)
- Basic IPv6 (no option yet, only the syntax is verified) (Pierre)
- Add support for custom decimal separator (Pierre)
- INT and Float filters trim the values before the validations (spaces only)
+- input_get and input_get_args returns now FALSE when the validation failed
+ and NULL when the variable has not been found
- Added JIT support
</notes>
<filelist>
<email>rasmus@php.net</email>
<active>yes</active>
</lead>
- <date>2006-01-23</date>
+ <date>2006-05-14</date>
<time>10:04:15</time>
<version>
<release>0.10.0</release>
- Basic IPv6 (no option yet, only the syntax is verified) (Pierre)
- Add support for custom decimal separator (Pierre)
- INT and Float filters trim the values before the validations (spaces only)
+- input_get and input_get_args returns now FALSE when the validation failed
+ and NULL when the variable has not been found
- Added JIT support
</notes>
<contents>
[3]=>
int(-23234)
[4]=>
- NULL
+ bool(false)
[5]=>
- NULL
+ bool(false)
[6]=>
array(0) {
}
[3]=>
float(-23234.123)
[4]=>
- NULL
+ bool(false)
[5]=>
- NULL
+ bool(false)
[6]=>
array(0) {
}
int(7)
int(16711680)
int(438)
-NULL
+bool(false)
int(0)
int(0)
int(-255)
int(-16711680)
int(-438)
int(6)
-NULL
-NULL
+bool(false)
+bool(false)
int(-1)
int(0)
-NULL
-NULL
-NULL
-NULL
-NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
Done
string(26) "ftp://ftp.example.com/tmp/"
string(11) "/tmp/test.c"
string(1) "/"
-NULL
+bool(false)
string(6) "http:/"
string(5) "http:"
string(4) "http"
string(2) "-1"
array(0) {
}
-NULL
+bool(false)
string(10) "http://qwe"
-NULL
-NULL
+bool(false)
+bool(false)
string(22) "http://www.example.com"
-NULL
+bool(false)
string(42) "http://www.example.com/path/at/the/server/"
-NULL
+bool(false)
string(40) "http://www.example.com/index.php?a=b&c=d"
Done
--EXPECT--
string(5) "a@b.c"
string(17) "abuse@example.com"
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
string(57) "QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET"
Done
?>
--EXPECTF--
string(4) "data"
-NULL
+bool(false)
string(4) "data"
-NULL
-NULL
+bool(false)
+bool(false)
Warning: filter_data(): 'regexp' option missing in %s on line %d
-NULL
+bool(false)
Done
?>
--EXPECT--
string(11) "192.168.0.1"
-NULL
+bool(false)
string(3) "::1"
string(7) "fe00::0"
-NULL
-NULL
+bool(false)
+bool(false)
string(9) "127.0.0.1"
-NULL
+bool(false)
string(12) "192.0.34.166"
string(9) "127.0.0.1"
string(9) "192.0.0.1"
string(12) "192.0.34.166"
-NULL
+bool(false)
string(15) "255.255.255.255"
-NULL
-NULL
-NULL
-NULL
-NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
string(3) "::1"
string(9) "127.0.0.1"
Done
echo "Done\n";
?>
--EXPECTF--
-NULL
-NULL
-NULL
-NULL
+bool(false)
+bool(false)
+bool(false)
+bool(false)
string(7) "1.1.1.1"
Done
);
foreach ($ipv6_test as $ip => $exp) {
$out = filter_data($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $out = (int) (is_null($out) ? 0 : 1);
+ $out = (int) ($out === false ? 0 : 1);
if ($exp != $out) {
echo "$ip failed\n";
}
float(0.007)
custom decimal:
-NULL
+bool(false)
float(1.234)
float(1.234)
Warning: filter_data(): decimal separator must be one char in %s on line %d
-NULL
-NULL
+bool(false)
+bool(false)
--- /dev/null
+--TEST--
+input_get_args()
+--FILE--
+<?php
+$data = array(
+ 'product_id' => 'libgd<script>',
+ 'component' => '10dhsajkkdhk <do>',
+ 'versions' => '2.0.33',
+ 'testscalar' => array('2','23','10','12'),
+ 'testarray' => '2',
+);
+
+$args = array(
+ 'product_id' => FILTER_SANITIZE_ENCODED,
+ 'component' => array(//'filter' => FILTER_VALIDATE_INT,
+ 'flags' => FILTER_FLAG_ARRAY,
+ 'options' => array("min_range"=>1, "max_range"=>10)
+ ),
+ 'versions' => array(
+ 'filter' => FILTER_SANITIZE_ENCODED,
+ 'flags' => FILTER_FLAG_SCALAR,
+ ),
+ 'doesnotexist' => FILTER_VALIDATE_INT,
+ 'testscalar' => FILTER_VALIDATE_INT,
+ 'testarray' => array(
+ 'filter' => FILTER_VALIDATE_INT,
+ 'flags' => FILTER_FLAG_ARRAY,
+ )
+
+);
+
+$myinputs = input_get_args($args, INPUT_DATA, $data);
+var_dump($myinputs);
+?>
+--EXPECT--
+array(6) {
+ ["product_id"]=>
+ string(17) "libgd%3Cscript%3E"
+ ["component"]=>
+ array(1) {
+ [0]=>
+ string(17) "10dhsajkkdhk <do>"
+ }
+ ["versions"]=>
+ string(6) "2.0.33"
+ ["doesnotexist"]=>
+ NULL
+ ["testscalar"]=>
+ bool(false)
+ ["testarray"]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}