Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

PHP error messages

Asked Modified Viewed 1,099 times
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
asked
Senior Member

Quote

Server software Linux Centos 7
Webserver software Apache/2
PHP version 7.2.17
PHP interface fpm-fcgi
MySQL Server version 5.5.41-MariaDB
PHPFusion version 8.00.22


Error    Date    Status
public_html/search.php
count(): Parameter must be an array or an object that implements Countable Line: 230


Take a look into the file vriendschap.net/public_html/search.php
Details
Error:    count(): Parameter must be an array or an object that implements Countable    Line:    230
File:    vriendschap.net/public_html/search.php    On Page:    /search.php
Date:    april 19 2019 22:54:39    Status:    


Source code (Line: 220 - 240)
220     $c_swords = count($swords); //sizeof($swords)
221     for ($i = 0; $i < $c_swords; $i++) {
222     $count += substr_count(strtolower($text), strtolower($swords[$i]));
223     }
224     return $count;
225    }
226    
227    function search_querylike($field) {
228     global $swords;
229     $querylike = "";
230     $c_swords = count($swords); //sizeof($swords)
231     for ($i = 0; $i < $c_swords; $i++) {
232     $querylike .= $field." LIKE '%".$swords[$i]."%'".($i < $c_swords - 1 ? " ".$_REQUEST['method']." " : "");
233     }
234     return $querylike;
235    }
236    
237    function search_fieldsvar() {
238     $fieldsvar = "(";
239     $numargs = func_num_args();
240


Investigated the error and found two solutions. Which one should be prefferred?

Rewrite:
     $c_swords = count($swords); //sizeof($swords)

Into: (found in first comment, https://stackoverflow.com/questions/48001569/phpmyadmin-count-parameter-must-be-an-array-or-an-object-that-implements-co)
     $c_swords = count((array)$swords); //sizeof($swords)

Or: (found https://stackoverflow.com/questions/53020833/count-parameter-must-be-an-array-or-an-object-that-implements-countable-in-lar)
     $c_swords = !empty($swords); //sizeof($swords)


Please advise.
0 replies

3 posts

F
Falk
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

Good find, !empty would be my first choice since it is cleaner and makes most sense procedural style.
0 replies
R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

https://github.com/PHPFusion/PHPFusion/commit/2f9cbfa82f9cc716342911c6d9462e9bffcb7714
0 replies
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks for fixing it.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

F
F
Falk 146
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
W
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
R
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet