Page 1 of 1

Hides forum: 8: Undefined offset: 0 smf.class.php line 449 & 455

Posted: Fri Dec 28, 2007 11:27 pm
by keltic
Hi,

I recently upgraded from php4/apache1.3 to php5/apache2.2. Now some topics on the forum don't display any more. In the errorlog is this error:

8: Undefined offset: 0
File: /home/xxx/public_html/joomla/components/com_smf/smf.class.php
Line: 455

or

8: Undefined offset: 0
File: /home/xxx/public_html/joomla/components/com_smf/smf.class.php
Line: 449


This is line 441-462 from smf.class.php. It has something to do with $matches[0] returning a empty value I think. Something similair as in this topic: http://www.joomlahacks.com/component/op ... pic,2503.0 Only there it is a notice, and on my site the forum disappears.

Code: Select all

            if (empty($headers) || empty($keywords) || empty($css)) {
                //if one is empty rebuild all
                $headers = '';
                $keywords = '';
                $css = '';
                $this->debug .= 'loading headers';
                $regex = '/<head>.*<\/head>/smi';
                preg_match($regex, $buffer, $matches);
                $headers = $matches[0];

                $regex = '/name="keywords" .*" \/>/i';
                preg_match($regex, $headers, $matches);
                $search = array ('/.*content="(.*)".*/i');
                $replace = array ('$1');
                $keywords = preg_replace($search, $replace, $matches[0]);

                $regex = '/<link rel="stylesheet" .*" \/>/';
                preg_match_all($regex, $headers, $matches);

                foreach ($matches[0] as $key => $val) {
                    $css .= $val."\n";
                }
Could someone please help?

Re: Hides forum: 8: Undefined offset: 0 smf.class.php line 449 & 455

Posted: Sun Dec 30, 2007 5:52 pm
by keltic
Nobody has a idea what is causing this? I did some more research, and I found only 1 other person with the same problem. It was caused by an corrupted table. All my tables are fine according to MySQL. I also noticed that these forumtopics are only not readable by moderators and higher, and some members. When I log out, or log in to a normal user account the topic displays just fine.

I'm runing joomla 1.1.13, SMF 1.1.4, JSMF 2.0.2.1 with php 5.2.5 en apache 2.2.6.

If anyone could help me with this, it would be really appreciated!

Re: Hides forum: 8: Undefined offset: 0 smf.class.php line 449 &

Posted: Mon Mar 03, 2008 7:02 pm
by vdrover
Repairing some corrupt tables in the DB solved this for me. There are some other fixes discussed on joomlahacks.com.