Home Joomla

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

Written by: Muninder

Updated: November, 6, 2011

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.

by