use Joomla\CMS\Factory;
$input = Factory::getApplication()->input;
$input->set('p1', "poronga");
$p1AsStr = $input->getString('p1'); // 'poronga',ok
$p1AsInt = $input->getInt('p1'); // 0, ok
$input->set('p2', ["poronga","pirincho"]);
$p2AsArr = $input->getArray('p2'); // ['poronga','pirincho'], ok
$p2AsStr = $input->getString('p2');
string
['poronga','pirincho']
PHP Built On Linux Linux-4 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64
Database Type mysql
Database Version 5.7.28-0ubuntu0.18.04.4
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.2.24-0ubuntu0.18.04.1
Web Server Apache/2.4.29 (Ubuntu)
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.9.14 Stable [ Amani ] 17-December-2019 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
api.joomla.org/cms-3/classes/Joomla.Input.Input.html#method_getString says:
getString(mixed $name, = $default) : string
some on getInt
¿doc is wrong?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-01-13 08:23:09 |
Closed_By | ⇒ | HLeithner |
Documentation Updated https://docs.joomla.org/Retrieving_request_data_using_JInput
The PHP doc blocks should be updated in the Joomla\CMS\Input\Input
and Joomla\Input\Input
classes to reflect that Joomla\Filter\InputFilter
can return arrays, it's not only the docs wiki that needs this update.
The filter API supports being given an array and applying the selected filter to all elements within it. So, the input API behavior is correct.