cvs: php-src /ext/filter/tests 037.phpt 038.phpt

From: Date: Tue, 03 Oct 2006 23:33:23 +0000
Subject: cvs: php-src /ext/filter/tests 037.phpt 038.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-40893@lists.php.net to get a copy of this message
pajoye Tue Oct 3 23:33:23 2006 UTC Modified files: /php-src/ext/filter/tests 038.phpt 037.phpt Log: - MFB http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/038.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/filter/tests/038.phpt diff -u /dev/null php-src/ext/filter/tests/038.phpt:1.2 --- /dev/null Tue Oct 3 23:33:23 2006 +++ php-src/ext/filter/tests/038.phpt Tue Oct 3 23:33:23 2006 @@ -0,0 +1,56 @@ +--TEST-- +Test scalar, array +--FILE-- +<?php + +$var = 12; +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL)); +var_dump($res); + +$var = array(12); +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL)); +var_dump($res); + +$var = 12; +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY)); +var_dump($res); + + + +$var = 12; +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY)); +var_dump($res); + +$var = array(12); +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY)); +var_dump($res); + +$var = array(12); +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY|FILTER_REQUIRE_ARRAY)); +var_dump($res); + +$var = array(12); +$res = filter_var($var, FILTER_VALIDATE_INT, array('flags'=>FILTER_FLAG_ALLOW_OCTAL|FILTER_FORCE_ARRAY)); +var_dump($res); + +?> +--EXPECT-- +int(12) +bool(false) +array(1) { + [0]=> + int(12) +} +bool(false) +array(1) { + [0]=> + int(12) +} +array(1) { + [0]=> + int(12) +} +array(1) { + [0]=> + int(12) +} http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/037.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/filter/tests/037.phpt diff -u /dev/null php-src/ext/filter/tests/037.phpt:1.2 --- /dev/null Tue Oct 3 23:33:23 2006 +++ php-src/ext/filter/tests/037.phpt Tue Oct 3 23:33:23 2006 @@ -0,0 +1,39 @@ +--TEST-- +GET and data callback tests +--GET-- +a=1&b=2 +--FILE-- +<?php +function myfunc($val) { + return $val . '_callback'; +} +echo filter_input(INPUT_GET, 'a', FILTER_CALLBACK, array("options"=>'myfunc')); +echo "\n"; +echo filter_input(INPUT_GET, 'b', FILTER_VALIDATE_INT); +echo "\n"; +$data = "data"; + +echo filter_var($data, FILTER_CALLBACK, array("options"=>'myfunc')); +echo "\n"; + +$res = filter_input_array(INPUT_GET, array( + 'a' => array( + 'filter' => FILTER_CALLBACK, + 'options' => 'myfunc' + ), + 'b' => FILTER_VALIDATE_INT + ) + ); + +var_dump($res); +?> +--EXPECT-- +1_callback +2 +data_callback +array(2) { + ["a"]=> + string(10) "1_callback" + ["b"]=> + int(2) +}

« previous php.cvs (#40893) next »