SimplePortal

Support => English Support => Topic started by: leftezi on January 03, 2010, 09:51:05 AM

Title: Undefined offset: 1 error
Post by: leftezi on January 03, 2010, 09:51:05 AM
I have SMF 2.0 RC2 with SP 2.3.1 and getting very often this error in my error log:

8: Undefined offset: 1
file: ..... ..... /Themes/default/PortalAdminBlocks.template.php (eval?)
line: 32

In the line 32 is only a
Code: [Select]
</tr>';
I have only one mod installed: the YouTube BBCode
Title: Re: Undefined offset: 1 error
Post by: Nathaniel on January 03, 2010, 08:12:39 PM
Seeing as its an eval template error, the file/line given by php is not correct.

If you disable template eval, then you will get a real error message.

You can use the Disable Template eval mod to disable the use of eval in the templates: http://custom.simplemachines.org/mods/index.php?mod=2054
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 03, 2010, 10:16:10 PM
I don't know how save that is. So i installed this in my home test server that was producing the same error.
After the mod installation - activation the error look like this:

8: Undefined offset: 1
file: C:/wamp/www/Themes/default/Portal.template.php
line: 32

line 32 in this file is:

Code: [Select]
==>32: 
<td id="sp_left"', !empty($modSettings['leftwidth']) ? ' width="' . $modSettings['leftwidth'] . '"' : '', $context['SPortal']['sides'][1]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' : '', '>';
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 03, 2010, 11:07:53 PM
Just now i realized that this option is already installed in the SMF 2.0 RC2 version. There is no need for mod installation. Am i wrong?
In my home server the option appears twice after the mod installation. In the web-site appears only once without mod installation.

After the "disable template eval" option checked (in web server), the error look like this:

8: Undefined offset: 1
file: ... .../Themes/default/Portal.template.php
line: 32

line 32 in this file is:

Code: [Select]
==>32:  <td id="sp_left"', !empty($modSettings['leftwidth']) ? ' width="' . $modSettings['leftwidth'] . '"' : '', $context['SPortal']['sides'][1]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' : '', '>';
i think is the same with this in home server but i posted it anyway just in case.
Title: Re: Undefined offset: 1 error
Post by: Nathaniel on January 04, 2010, 08:58:41 AM
That setting should not be there by default, its possible that your package manager made the edits twice. That can happen if you try to reload the page or if something else goes wrong.

Could you please attach your entire Themes/default/Portal.template.php file?
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 04, 2010, 09:03:10 AM
I have Greek language in SMF (i don't know if this plays some role).

Here is my file attached.

Thank you.
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 04, 2010, 09:07:33 AM
You mean the option to disable eval with the checkbox should not be there by derault?

In the web-site i have never installed the mod and this was there already!!
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 20, 2010, 03:22:46 PM
I can't think of a case which has index 1 unset. Can you attach your ./Sources/Subs-Post.php and ./index.php files here?
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 21, 2010, 06:38:32 AM
Here they are:
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 21, 2010, 12:10:03 PM
I was probably too tired after writing a long school paper, sorry. I actually need Subs-Portal.php file.
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 21, 2010, 02:49:33 PM
Ok, no problem. Thanks for your time.
Here is the Subs-Portal.php:
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 21, 2010, 03:19:31 PM
I see. Do you have blocks enabled when you are in the admin area?
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 21, 2010, 07:46:58 PM
Yes. They are enabled.
And i think you have right. The error in line 32 is produced when i am in the admin area and accessing in the block list.
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 22, 2010, 08:16:16 AM
Okay. I know what the issue is, but it would require quite a few changes to fix this. I'll file a bug report about this. I would suggest disabling blocks in admin areas until the next release.
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 22, 2010, 08:20:58 AM
Ah. I see.
About the block disabling in admin area:
Is there a danger for any damage or is recommended just to not produce the errors.
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 22, 2010, 08:22:50 AM
Nope, those errors won't cause any damage. It will just fill up your error log. You can disable blocks in certain areas through Admin > SimplePortal > Configuration > Block Settings area though.
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 22, 2010, 08:25:27 AM
Bug Report: http://simpleportal.net/index.php?issue=337.0
Title: Re: Undefined offset: 1 error
Post by: leftezi on January 22, 2010, 08:38:39 AM
Ok, thank you.
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on January 22, 2010, 08:51:56 AM
My pleasure. ;)
Title: Re: Undefined offset: 1 error
Post by: MultiformeIngegno on February 11, 2010, 06:25:15 PM
Can you post the fix? :)
Title: Re: Undefined offset: 1 error
Post by: ccbtimewiz on February 11, 2010, 10:57:52 PM
Why not just remove the array reset, [SiNaN]?
Title: Re: Undefined offset: 1 error
Post by: [SiNaN] on February 27, 2010, 05:42:26 AM
Can you post the fix? :)

I guess you could live without blocks in the admin areas until 2.3.2 or 2.4 version is relased, since I'm too lazy to post the necessary edits.

Why not just remove the array reset, [SiNaN]?

Array reset? You mean $context['SPortal'] = array(); in sportal_init() function? That won't change anything since sportal_init() is called before sportal_admin_block_list(). The issue is both functions use $context['SPortal']['sides'] index. The easiest way to fix this is to change the index used in the admin area.
SimplePortal 2.3.8 © 2008-2024, SimplePortal