note 96736 modified in function.filter-input-array by danbrown

From: Date: Mon, 15 Mar 2010 16:37:11 +0000
Subject: note 96736 modified in function.filter-input-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167054@lists.php.net to get a copy of this message
While filtering input arrays, be careful of what flags you set besides FILTER_REQUIRE_ARRAY. For example, setting the flags like so: <?php $filter = array( 'myInputArr' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => array('FILTER_FLAG_STRIP_LOW', 'FILTER_REQUIRE_ARRAY')) ); $form_inputs = filter_input_array(INPUT_POST, $filter); ?> .. will result in a blank $form_inputs['myInputArr'] regardless of what $_POST['myInputArr'] contains. --was-- While filtering input arrays, be careful of what flags you set besides FILTER_REQUIRE_ARRAY. For example, setting the flags like so: $filter = array( 'myInputArr' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => array('FILTER_FLAG_STRIP_LOW', 'FILTER_REQUIRE_ARRAY')) ); $form_inputs = filter_input_array(INPUT_POST, $filter); .. will result in a blank $form_inputs['myInputArr'] regardless of what $_POST['myInputArr'] contains. http://php.net/manual/en/function.filter-input-array.php

« previous php.notes (#167054) next »