Bug #76734 [Asn->Opn]: Parameter type cannot be limited to scalar with FILTER_CALLBACK

From: Date: Tue, 14 Aug 2018 02:01:18 +0000
Subject: Bug #76734 [Asn->Opn]: Parameter type cannot be limited to scalar with FILTER_CALLBACK
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216772@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76734&edit=1 ID: 76734 User updated by: 498936940 at qq dot com Reported by: 498936940 at qq dot com Summary: Parameter type cannot be limited to scalar with FILTER_CALLBACK -Status: Assigned +Status: Open Type: Bug Package: Filter related Operating System: Linux PHP Version: 7.2.8 Assigned To: cmb Block user comment: N Private report: N New Comment: Not just the Documentation Problem problem, but Bug still has problems. Previous Comments: ------------------------------------------------------------------------ [2018-08-14 01:12:14] 498936940 at qq dot com ··· var_dump( filter_input_array( INPUT_GET, [ 'id' => [ 'filter' => FILTER_CALLBACK, 'options' => function($v){ return is_scalar($v) ? $v : null; } ] ] ) ); exit(); /?id=2 array(1) { ["id"]=> string(1) "2" } /?id[]=3&id[]=4 array(1) { ["id"]=> array(2) { [0]=> string(1) "3" [1]=> string(1) "4" } } ··· I must limit ID must be scalar, not array, filter cannot control! ------------------------------------------------------------------------ [2018-08-13 11:42:53] cmb@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. ------------------------------------------------------------------------ [2018-08-13 11:42:24] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&revision=345461 Log: Fix #76734: Parameter type cannot be limited to scalar with FILTER_CALLBACK ------------------------------------------------------------------------ [2018-08-13 06:45:13] requinix@php.net Flags are not used with FILTER_CALLBACK. 'id' => [ 'filter' => FILTER_CALLBACK, 'options' => function($v){ return is_scalar($v) ? $v : null; }, ] ------------------------------------------------------------------------ [2018-08-13 05:21:00] 498936940 at qq dot com Description: ------------ --- var_dump( filter_input_array( INPUT_GET, [ 'id' => [ 'filter' => FILTER_CALLBACK, 'options' => function($v){return $v;}, 'flags' => FILTER_REQUIRE_SCALAR, ] ] ) ); exit(); /?id=2 array(1) { ["id"]=> string(1) "2" } /?id[]=3&id[]=4 array(1) { ["id"]=> array(2) { [0]=> string(1) "3" [1]=> string(1) "4" } } --- I must limit ID must be scalar, not array, filter cannot control! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76734&edit=1

« previous php.bugs (#216772) next »