Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: GL700Wing on June 20, 2017, 10:39:03 PM

Title: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: GL700Wing on June 20, 2017, 10:39:03 PM
This issue is similar to https://www.simplemachines.org/community/index.php?topic=554454.msg3930251#msg3930251

After changing the Search Method to Fulltext the error '[] operator not supported for strings' is thrown whenever the 'Search Methods' menu is selected.

The fix is as follows:
In ./Sources/ManageSearch.php
Find:
        $context['fulltext_index'] = '';
        if ($request !== false || $smcFunc['db_num_rows']($request) != 0)

Replace With:
        $context['fulltext_index'] = array();
        if ($request !== false || $smcFunc['db_num_rows']($request) != 0)





I've confirmed this issue also affects SMF 2.1 Beta 3 - error log info is as follows:
[21-Jun-2017 02:23:37 UTC] PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php:826
Stack trace:
#0 /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php(219): detectFulltextIndex()
#1 /home/abcdefg/public_html/forum_21B3/Sources/Subs.php(4584): EditSearchMethod()
#2 /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php(77): call_helper('EditSearchMetho...')
#3 /home/abcdefg/public_html/forum_21B3/Sources/Admin.php(495): ManageSearch()
#4 /home/abcdefg/public_html/forum_21B3/index.php(152): AdminMain()
#5 {main}
  thrown in /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php on line 826

Title: Re: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: vbgamer45 on June 20, 2017, 11:02:38 PM
Submitted to github issue https://github.com/SimpleMachines/SMF2.1/issues/4145
Title: Re: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: @rjen on November 20, 2017, 01:53:15 PM
I noticed this one bug has not been fixed in version 2.0.15...

is that on purpose?
Title: Re: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: Plus on November 25, 2019, 02:26:11 PM
Quote from: GL700Wing on June 20, 2017, 10:39:03 PM
This issue is similar to https://www.simplemachines.org/community/index.php?topic=554454.msg3930251#msg3930251

After changing the Search Method to Fulltext the error '[] operator not supported for strings' is thrown whenever the 'Search Methods' menu is selected.

The fix is as follows:
In ./Sources/ManageSearch.php
Find:
        $context['fulltext_index'] = '';
        if ($request !== false || $smcFunc['db_num_rows']($request) != 0)

Replace With:
        $context['fulltext_index'] = array();
        if ($request !== false || $smcFunc['db_num_rows']($request) != 0)





I've confirmed this issue also affects SMF 2.1 Beta 3 - error log info is as follows:
[21-Jun-2017 02:23:37 UTC] PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php:826
Stack trace:
#0 /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php(219): detectFulltextIndex()
#1 /home/abcdefg/public_html/forum_21B3/Sources/Subs.php(4584): EditSearchMethod()
#2 /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php(77): call_helper('EditSearchMetho...')
#3 /home/abcdefg/public_html/forum_21B3/Sources/Admin.php(495): ManageSearch()
#4 /home/abcdefg/public_html/forum_21B3/index.php(152): AdminMain()
#5 {main}
  thrown in /home/abcdefg/public_html/forum_21B3/Sources/ManageSearch.php on line 826



thank you :)
Title: Re: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: shawnb61 on November 30, 2019, 02:24:41 PM
Confirming this is addressed in 2.0.16
Title: Re: SMF 2.0.x and PHP 7.1 Search Method [] operator not supported for strings
Post by: shawnb61 on December 28, 2019, 02:45:57 PM
Fixed in 2.0.16.