1--TEST-- 2filter_var() / filter_var_array() and passed data integrity 3--SKIPIF-- 4<?php if (!extension_loaded("filter")) die("skip"); ?> 5--FILE-- 6<?php 7function filter_cb($var) 8{ 9 return 1; 10} 11 12$data = array ('bar' => array ('fu<script>bar', 'bar<script>fu') ); 13var_dump(filter_var($data, FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY)); 14var_dump($data); 15var_dump(filter_var($data, FILTER_CALLBACK, array('options' => 'filter_cb'))); 16var_dump($data); 17var_dump(filter_var_array($data, array('bar' => array('filter' => FILTER_CALLBACK, 'options' => 'filter_cb')))); 18var_dump($data); 19--EXPECT-- 20array(1) { 21 ["bar"]=> 22 array(2) { 23 [0]=> 24 string(5) "fubar" 25 [1]=> 26 string(5) "barfu" 27 } 28} 29array(1) { 30 ["bar"]=> 31 array(2) { 32 [0]=> 33 string(13) "fu<script>bar" 34 [1]=> 35 string(13) "bar<script>fu" 36 } 37} 38array(1) { 39 ["bar"]=> 40 array(2) { 41 [0]=> 42 int(1) 43 [1]=> 44 int(1) 45 } 46} 47array(1) { 48 ["bar"]=> 49 array(2) { 50 [0]=> 51 string(13) "fu<script>bar" 52 [1]=> 53 string(13) "bar<script>fu" 54 } 55} 56array(1) { 57 ["bar"]=> 58 array(2) { 59 [0]=> 60 int(1) 61 [1]=> 62 int(1) 63 } 64} 65array(1) { 66 ["bar"]=> 67 array(2) { 68 [0]=> 69 string(13) "fu<script>bar" 70 [1]=> 71 string(13) "bar<script>fu" 72 } 73} 74