Solve the ‘Warning: trim() expects parameter 1’ Joomla Error

Published On :

Joomla Errors are a nightmare for any Web Developer. Unlike WordPress, Joomla doesn’t have a huge community where users discuss their problems daily and get it solved within minutes.

The reason for that is Joomla is a pure CMS very similar to Drupal and extremely dissimilar to WordPress. So any error in Joomla doesn’t get solved so easily as it does in WordPress.

But again if you know the CMS very well it won’t be a problem to solve these sort of errors. Last time we gave the solution to the ‘JFolder::create: Could not create directory Error’.

I had faced that error when I moved a Joomla site from one host to another. Yesterday I noticed this warning when visiting one of our client’s site for which I have done SEO. So it was just a routine check-up for redirect errors and plugin updates.

SYNTAX :-

Warning: trim() expects parameter 1 to be string, array given in ..\libraries\joomla\html\parameter.php on line 83

Here ‘..’ means the path of your Joomla site.

CAUSE :-

There is no categorical cause for this warning. But for me it was due to the JoomSEO plugin. When I searched in Joomla forums, users also reported that they faced this issue when a new Template was installed. I would recommend you to Uninstall the plugin/component/template which is causing this Warning. It’s not Joomla’s fault but the plugin or template is asking extra things from the core Joomla code, resulting in this.

Unless, the plugin or template is very much needed avoid using it. This error occurs on localhost as well as on a server. Without much bragging let’s move on to the solution.

Joomla Warning

Warning displayed on one of our Joomla site

Fix for ‘Warning: trim() expects parameter 1’ Error

  1. Open your CPanel or any other Hosting client software. Once done, navigate to the path where you’ve your Joomla powered site.
  2. Then go inside \libraries\joomla\html and open up the parameter.php file in Code Edit view. I say code edit view because it will be easier for you to find the 83rd line which we are going to edit.
  3. Find
    if (trim($data))
    {
    $this->loadINI($data);
    }

    and Replace with

    if (gettype($data) == 'array')
    {
    foreach ($data as $data_string)
    {
    if (trim($data_string))
    {
    $this->loadINI($data_string);
    }
    }
    }
    else
    {
    if (trim($data))
    {
    $this->loadINI($data);
    }
    }
  4. That will solve your problem.

Actual credit for this solution goes to marlon_andrei from Joomla Forum. Hope it solves your problem as well.

If you face any problem then feel free to share it with us in the Comments section. We’ll definitely look to solve it as quickly as possible.

Share :
Tagged as : 22 Comments
About » Has written 231 Post(s) «

I'm a Web Designer/Developer, SEO'er and a Blogger who gives a few Blogging Tips in the form of posts/tutorials. Follow & Subscribe to my Blog if you feel it's worth it.

HostGator
Loader

22 Comments Comments RSS

  1. #

    thanks its helped me alot for my new joomla blog.nice solution :)

  2. #

    That is why it is not advisable to use joomla. I’d go for wordpress because wordpress is a lot more easier to use.

  3. #

    I don’t use Joomla except a couple of projects last time. Thanks for the nice tip though!

  4. #

    Joomla has an very big community and every users are discuss their problem in day to day life and it can be solve within a second. I would like to say thanks for sharing your great post on here.

  5. norma
    #

    [Translated]
    Thanks really helped me your explanation and solution x .. looking elsewhere and nothing until I found this site .. q thousand graciaaaaaaaaaaaaas ..

  6. Andrew
    #

    As you noted I had the error with the joomla 1.5.25 php 5.3.8 and the joomSEO plugin

    Rather than messing with the core Joomla files you can fix the error in joomSEO directly.

    plugins/system/JoomSEO.php

    at line 46

    // get plugin parameters
    // $this->params = new JParameter($params);
    $this->params = new JParameter($params['params']);

    You may have other plugins causing issues, but this solved my problem

  7. #

    WRONG! No Joomla core modifications! Will have many bugs. The issue is caused bu JoomSEO plugin. Disable it and see the error disappear. Andrew, thanks a lot!

  8. José Luz
    #

    Thanks man! resolved my problem, helped me! tnks!

  9. Marcelo
    #

    [Translated] thank you very much

  10. #

    My site had this problem and did not know how to solve it. Thanks for this great article!

  11. priya
    #

    I also having the same problem. Thanx for your help… :)

  12. #

    Thank you for posting this fix, was a enormous help!

  13. Divya Jha
    #

    Thanks Dear. it resolved.:)

  14. #

    Thanks a ton…U saved my lyf….

  15. #

    your amazing, thanks…

  16. #

    very annoying error. this solution fixed it ;) thanks

  17. Danny
    #

    it´s also possible to convert the value before using of trim() => trim(strval($Value))

    solution:

    $data = strval($data); // Convert to string
    if (trim($data))
    {
    $this->loadINI($data);
    }

  18. unnikrishnan
    #

    thanks… its helped me a lot….

  19. #

    This was a great help thanks!!!!

  20. #

    thanks, solved my warning

  21. #

    It is working fine, thanks a lot.

  22. Tom
    #

    Thanks Andrew! Your solution worked like a charm without having to tamper the core Joomla! files.

    I just followed this as directed by Andrew:
    As you noted I had the error with the joomla 1.5.25 php 5.3.8 and the joomSEO plugin

    Rather than messing with the core Joomla files you can fix the error in joomSEO directly.

    plugins/system/JoomSEO.php

    // get plugin parameters
    // $this->params = new JParameter($params);
    $this->params = new JParameter($params['params']);

    WordPress may be easier to use, but in terms of high customization and techie centric aspects, Joomla! rocks. I have been running a number of sites without any problems, when compared with WordPress where WP based sites get hacked often and it is annoying.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Also, use your Real name in the 'Name' field. Comment names with only keywords will be trashed.