? Pending

User tests: Successful: Unsuccessful:

avatar chrisdavenport
chrisdavenport
8 May 2016

Under some circumstances a search for a word can result in a "PHP Fatal error: utf8_strpos: Offset must be an integer". This is because the floor function used to calculate the offset can sometimes return a float rather than an int.

Summary of Changes

The return value from the floor is now cast to an int to make sure that the offset (the 3rd argument) passed to JString::strpos, which becomes the offset argument to utf8_strpos, is always an int.

Testing Instructions

This may be tricky to replicate but this is how I encountered the problem in the first place...

  1. Fresh install of Joomla with the Testing sample data set (the last option on the list).
  2. Enable Smart Search and index the content.
  3. From the front-end, go to the Smart Search search component page.
  4. Enter "the" as the search term and click Search.

This should throw the error on one of the search results. For me it happened on "Modules" and "Sample Sites".

Apply this PR and repeat the test.

avatar chrisdavenport chrisdavenport - open - 8 May 2016
avatar chrisdavenport chrisdavenport - change - 8 May 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 8 May 2016
Category Search
avatar chrisdavenport
chrisdavenport - comment - 8 May 2016

One more thing: This might be PHP7-related. I don't have access to an earlier PHP release at the moment to test it, but it's strange that I haven't seen this issue until running on PHP7 for the first time.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10303.

avatar wilsonge wilsonge - close - 8 May 2016
avatar wilsonge wilsonge - merge - 8 May 2016
avatar wilsonge wilsonge - reference | a0acdd7 - 8 May 16
avatar wilsonge wilsonge - merge - 8 May 2016
avatar wilsonge wilsonge - close - 8 May 2016
avatar wilsonge wilsonge - change - 8 May 2016
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-08 09:56:46
Closed_By wilsonge
avatar wilsonge wilsonge - change - 8 May 2016
Milestone Added:
avatar wilsonge wilsonge - change - 8 May 2016
Milestone Added:
avatar wilsonge wilsonge - change - 8 May 2016
Milestone Removed:
avatar roland-d roland-d - reference | 47ec21a - 8 May 16
avatar zero-24 zero-24 - test_item - 8 May 2016 - Tested successfully
avatar zero-24
zero-24 - comment - 8 May 2016

I have tested this item :white_check_mark: successfully on 4fb9192

:+1:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10303.

Add a Comment

Login with GitHub to post a comment