2.5.4 setup / Notice: Array to string conversion

This forum is for issues with installing Joomla! 2.5 (All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5.) on IIS webservers.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
shifty_
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Nov 13, 2007 4:52 am
Location: Adelaide, Australia

2.5.4 setup / Notice: Array to string conversion

Post by shifty_ » Wed May 30, 2012 1:52 am

Hi all - sorry to bump an old thread but I am getting something very similar to this with Joomla 2.5.4 and I have scoured the net with no success so far.

I have a client who is self hosting a Joomla website on IIS 7.5 and the site works great, but I am trying to enable the Latest News module and everytime I do that the site breaks with the same error as mentioned by the OP.
PHP Notice: Array to string conversion in C:\www\components\com_content\models\articles.php on line 132
That particular line is:

Code: Select all

$id .= ':'.$this->getState('filter.category_id');
Firstly I am more a designer than a developer, so knowledge of PHP is minimal.

I have tried with PHP 5.4.0 and PHP 5.4.3. I have also tried a clean Joomla install with no other extensions, modules, templates etc. added and simply enabled the Latest News module and thats when it breaks.

I may have something misconfigured because I had to set up the environment myself but I have tried a lot of random stuff and nothing has worked so far. Anyone have any ideas?

What does Array to string conversion even mean? And why would enabling that module cause it to break?

Cheers

shifty
Last edited by humvee on Fri Jun 08, 2012 12:27 pm, edited 1 time in total.
Reason: Marked Resolved

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14713
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: 2.5.4 setup / Notice: Array to string conversion

Post by humvee » Wed May 30, 2012 7:29 am

[Mod Note: You were right to apologize for bumping old thread! Split topic into new thread as related to different version. It also relates to an issue which is occurring on an IIS 7.5 web server that has its own forum and its not even anything to do with the installation of Joomla! itself!]

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14713
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: 2.5.4 setup / Notice: Array to string conversion

Post by humvee » Wed May 30, 2012 7:50 am

The hint as to where to start looking for this error is in the original code you quoted "PHP Notice:...." This immediately tells you it is an issue with PHP surely?

I am assuming that you are also using MSSQL although this is not an absolute it seems for this error to arise, and its occurrence seems pretty widespread across many different software projects.

A search of
PHP 5.4 errors on IIS AND "Array to string conversion"
in Google would have revealed this. At the moment from initial reading of some of the topics and reference to http://PHP.net there does not seem to have been a fix for this bug. I have raised the point with one of the developers, but I do not believe as yet that Joomla has had widespread testing on PHP5.4 although I may be wrong in this assumption (IANAD!).

shifty_
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Nov 13, 2007 4:52 am
Location: Adelaide, Australia

Re: 2.5.3 setup / Notice: Array to string conversion

Post by shifty_ » Wed May 30, 2012 10:32 pm

Hi Humvee - sorry again for the bump - I don't spend a lot of time in forums. Obviously need to learn the ettiquette.

I assumed it was not an issue with Joomla! because no-one else was having the problem. It has to be something to do with my setup - but because I was trying to get a feature of Joomla! enabled I was hoping I could find some help here.

I am using MySQL (5.5.24) with IIS7.5 and have tried both PHP 5.4.0 and 5.4.3.

I have done a lot of troubleshooting with PHP (hence trying the 2 versions) because I assumed that's where the propblem was, but I have not had any luck so far.

Cheers

shfity

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14713
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: 2.5.4 setup / Notice: Array to string conversion

Post by humvee » Mon Jun 04, 2012 11:44 am

For now suggest stepping back to 5.3.x as there appear to be a number of issues with recent changes made to 5.4 of which this is just one.

Jaimied
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jun 05, 2012 10:47 pm

Re: 2.5.4 setup / Notice: Array to string conversion

Post by Jaimied » Tue Jun 05, 2012 11:59 pm

Thanks Humvee, came across the same problem as shifty. Went back to PHP version 5.3.13 and works like a charm! :pop

optikool
Joomla! Intern
Joomla! Intern
Posts: 87
Joined: Mon Oct 19, 2009 8:39 pm
Location: Bay Area, California
Contact:

Re: 2.5.4 setup / Notice: Array to string conversion

Post by optikool » Mon Jan 28, 2013 8:41 pm

I ran into this problem with 2.5.8... and php 5.4.7. It's odd this still hasn't been fixed, but I ended up modifying the /libraries/joomla/chache/cache.php and added the following function...

Code: Select all

public static function array_diff_assoc_recursive($array1, $array2) { 
	    foreach ($array1 as $key => $value) { 
	        if (is_array($value)) { 
	              if (!isset($array2[$key]) || !is_array($array2[$key])) { 
	                  $difference[$key] = $value; 
	              } else { 
	                  $new_diff = self::array_diff_assoc_recursive($value, $array2[$key]); 
	                  if ($new_diff != FALSE) { 
	                        $difference[$key] = $new_diff; 
	                  } 
	              } 
	          } elseif (!isset($array2[$key]) || $array2[$key] != $value) { 
	              $difference[$key] = $value; 
	          } 
	    } 
	    return !isset($difference) ? 0 : $difference; 
	}
I then changed the code that was causing the error, on line 584 to look like the following...
$newvalue = self::array_diff_assoc_recursive($headnow[$now], isset($options['headerbefore'][$now]) ? $options['headerbefore'][$now] : array());

This resolved my problem. This has been tested on XAMPP 3.1.0. I hope the devs will come up with a permanent fix so I don't have to remember to add this code my self when I move to production.

Thanks
Optikool

User avatar
Azamkl
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Sat Mar 25, 2006 2:43 am
Location: Malaysia
Contact:

Re: 2.5.4 setup / Notice: Array to string conversion

Post by Azamkl » Mon Apr 28, 2014 7:37 pm

I too have the same issue. The solutions provided by 'optikool' solve the error I'm facing with. Thanks for the highlight. ;D
~Engrave the Creativity~


Locked

Return to “Joomla! 2.5 on IIS webserver”