Categories > TinyButStrong general >

undefined offset and index

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: NM
Date: 2006-06-04
Time: 16:07

undefined offset and index

Hi all,
I'm getting this repeated error and was wondering what could be causing  it. The page renders fine with all the info on it but this error message also appears 'behind' the page.
There is no problem when working on my own computer (for development) but when I upload the files to the server I see the error.
Perhaps it as something to do with the mySql version?
I get the same message with tbs 2.x and 3.x

<b>Notice</b>:  Undefined offset:  0 in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1724</b><br />
<br />
<b>Notice</b>:  Undefined index:   in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1943</b><br />
<br />

<b>Notice</b>:  Undefined index:   in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1996</b><br />
<br />
<b>Notice</b>:  Undefined offset:  0 in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1724</b><br />
<br />
<b>Notice</b>:  Undefined index:   in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1943</b><br />

<br />
<b>Notice</b>:  Undefined index:   in <b>/home/fruittree/web/tbs_class.php</b> on line <b>1996</b><br />
By: TomH
Date: 2006-06-05
Time: 00:13

Re: undefined offset and index

Which versions of PHP are running on the servers?
By: NM
Date: 2006-06-05
Time: 02:30

Re: undefined offset and index

TomH,
The server is running 4.3.11
I'm running 5.0.5
By: Skrol29
Date: 2006-06-05
Time: 10:17

Re: undefined offset and index

Hi NM,

This error message seems to be related to a MergeBlock() call.
Could you post a snippet of the block source of this block ?
By: NM
Date: 2006-06-05
Time: 15:58

Re: undefined offset and index

Hi Scrol29
I think the problem may lie in this part of the HTML code

[block2.Category; block=tr; headergrp=Category]</td>
    </tr>
    <tr>
        <td><a href="story_link.php?story_ID=[block2.ID]&get_story=2&Years=[var.this_year]&Months=[var.this_month]&month_name=[var.month_name]&cover=[block_pix.Cover_name]">[block2.Headline; block=tr; headergrp=Headline] </a><br>
        </td>

The same page also includes this code below but this does not show anything (correctly) until clicking on the link above which sets get_story to "2"

<td bgcolor="#339933"><font color="white">[onload; block=table; when [var.get_story]=2] <strong>Category:</strong>
                                [block4.Category; block=tr; headergrp=Category]</font></td>
                            </tr>
                            <tr>
                                <td><b><font color="#339933">&gt;&gt;[block4.Headline; block=tr; headergrp=Headline]</font></b></td>
                            </tr>
                            <tr>
                                <td><font color="#cc0000"> [block4.Story_intro; block=tr;]</font>
            <p><font color="#cc0000">[block4.Story_all; block=tr;]</font></p>
        </td>

Setting
error_reporting(0);
in the php fixes the problem - but this is not really satisfactory.

Here is the php
error_reporting(0);
require('cnx_fruittree.php');
include_once('tbs_class.php');

$TBS->NoErr = true; // no more error message displayed.
$TBS = new clsTinyButStrong;
.
.
$TBS->LoadTemplate ('templ.html');

$TBS->MergeBlock('block2',$cnx_fruittree,'SELECT * FROM stories WHERE Years='.$this_year.' AND Months='.$this_month.' ORDER by Category');

$TBS->MergeBlock('block_pix',$cnx_fruittree,'SELECT * FROM pixmonth WHERE Year='.$this_year.' AND Month='.$this_month.'');

$TBS->Show();
By: Skrol29
Date: 2006-06-06
Time: 01:06

Re: undefined offset and index

Hi NM,

Thanks for having reporting this problem.
I've found the bug. It happens when you merge a block with Header/Footer/Splitter grp sections or When sections but without normal section.

The bug will be fixed with the new release 3.01.0, coming soon.
By: Skrol29
Date: 2006-06-07
Time: 02:56

Re: undefined offset and index

Hi,

The bug is fixed in the beta available here :
http://www.tinybutstrong.com/download/download.php?file=tbs_beta.zip&sid=3

This beta is a release candidate.
It goes with 2 plug-ins updates.