Use any existing form or create a form with a text field.
Pass input value mixed with character and integer multiple times like "test123test456" and submit.
Get input value of form field using input filtering method getInt() like below:
$integer = JFactory::getApplication->input->getInt( 'name_of_input_field' );
OR
(1) Open this file of your Joomla: components/com_search/controller.php
(2) Add below line in search() method as first line (Line: 46)
echo $this->input->getInt('searchword', null); die;
(3) Go to front-end of your joomla site and type "test123test456" in Joomla search input.
Above will show the filtered value submitted by search input.
Variable should return "123456" as we have filtered integer values only
But actually it returns "123" only. Means it returns first integer value occurrence only.
Joomla! 3.6.3-dev
The problem is in clean() method of libraries/joomla/filter/input.php library file.
I found that preg_match() returns only first occurrence on line no:167 for the input value.
Alternatively we can use pattern like below:
$pattern = '/[^-+0-9]/';
and preg_match() should replace with preg_replace() like below:
$matches = preg_replace($pattern, '', (string) $source);
Same issue I found with UINT case too.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-13 11:35:15 |
Closed_By | ⇒ | brianteeman |
@brianteeman the PR link is #11582. Please update PR link in your comment.
Oops - done
If this is a big problem, Please also open an issue/PR with the Framework filter package. https://github.com/joomla-framework/filter
(the CMS has some slight differences from the Framework package that it extends from).
Don't ask me. That API predates me.
On Sunday, August 14, 2016, Walt Sorensen notifications@github.com wrote:
@mbabker https://github.com/mbabker and or @wilsonge
https://github.com/wilsonge would possibly have insights into why we
only match the first int substring.I'm sure that only match the first int substring was an intentional design
choice. (as evident in the Unit tests)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11569 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWfoRPGptKBZuwwFh0P4GsPtTpwiTVCks5qf8fygaJpZM4JjGNj
.
PR for this issue #11582
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11569.