Smart Search: utf8_strpos: Offset must be an integer#10303
Merged
wilsonge merged 1 commit intojoomla:stagingfrom May 8, 2016
Merged
Smart Search: utf8_strpos: Offset must be an integer#10303wilsonge merged 1 commit intojoomla:stagingfrom
wilsonge merged 1 commit intojoomla:stagingfrom
Conversation
Contributor
Author
|
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. |
roland-d
added a commit
to roland-d/joomla-cms
that referenced
this pull request
May 8, 2016
…leanup-installer-plugins * 'staging' of https://github.com/joomla/joomla-cms: Smart Search: utf8_strpos: Offset must be an integer (joomla#10303) Removed an redundant else clause from JFeedParser::processElement (joomla#7961) CLEANING-JDataSet (joomla#7947) CLEANING-JAdapter (joomla#6679) Same treatment as JArchiveBzip2 and JArchiveGzip (joomla#6515) Cleaning up JArchiveBzip2 (joomla#6495) Removed the nested conditional switch construct (joomla#6338) add edit tooltip to modules (joomla#10295) New installer plugins: remove the dot in the plugin name and other language review (joomla#10299)
Contributor
|
I have tested this item ✅ successfully on 4fb9192 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10303. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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...
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.