Notice: Undefined offset: 1 in system/classes/format.php line 238

23 views
Skip to first unread message

Balazs Koren

unread,
Aug 16, 2008, 6:28:51 AM8/16/08
to habari...@googlegroups.com
Hello,

I'm having fun using habari, but if I go for the tag archive, a lot of time I get the following message in the log: Notice: Undefined offset: 1 in system/classes/format.php line 238

Can somebody tell me why this happens? You can give it a try, for example I get it looking for the tag archive here: http://kobak.org/tag/for-the-record

I'm using 0.6-alpha.

Thanks for any advise.

Michael C. Harris

unread,
Aug 16, 2008, 6:41:49 AM8/16/08
to habari...@googlegroups.com
On Sat, Aug 16, 2008 at 12:28:51PM +0200, Balazs Koren wrote:
> Hello,
> I'm having fun using habari, but if I go for the tag archive, a lot of
> time I get the following message in the log: Notice: Undefined offset:
> 1 in system/classes/format.php line 238
> Can somebody tell me why this happens? You can give it a try, for
> example I get it looking for the tag archive
> here: [1]http://kobak.org/tag/for-the-record

> I'm using 0.6-alpha.
> Thanks for any advise.

I think this is likely to be a theme issue. Is the theme using
something from the Format class that's filtering post_content_out ?

--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog
IRC: michaeltwofish #habari

Balazs Koren

unread,
Aug 16, 2008, 9:52:19 AM8/16/08
to habari...@googlegroups.com
Hi,

I'm using the default Charcoal theme. 

Balazs

Ali B.

unread,
Aug 16, 2008, 12:33:11 PM8/16/08
to habari...@googlegroups.com
It's strange. I am also using charcoal and running latest HEAD. Works without problems (http://awhitebox.com/tag/habari).

Is it possible that a plugin is trying to use the Format::summarize function? Could you maybe list the plugins you have installed/activated so I can take a look at them?

Also, have you added any additional functions to the theme's theme.php? If so, could you please paste what you added?

Welcome to Habari by the way :)

Cheers,
--
Ali B / dmondark
http://www.awhitebox.com

Ali B.

unread,
Aug 16, 2008, 12:35:34 PM8/16/08
to habari...@googlegroups.com
You might also enable debug to display the error stack trace. Just paste the following line in your config.php between the php tags:

define('DEBUG', true);

Balazs Koren

unread,
Aug 16, 2008, 3:39:28 PM8/16/08
to habari...@googlegroups.com
interesting fact is, that I only get the error message if the post: http://kobak.org/latin1-tablaban-tarolt-utf8-tartalom is included in the tag archive. The post in single mode appears alright.

By the debug I get:

---
system/classes/format.php line 306:
  Format::summarize( ...1 args... )
[core] line 0:
  Format->more( ...1 args... )
system/classes/format.php(64) : runtime-created function line 1:
  call_user_func_array( ...1 args... )
[core] line 0:
  __lambda_func( ...1 args... )
system/classes/plugins.php line 92:
  call_user_func_array( ...1 args... )
system/classes/post.php line 793:
  Plugins::filter( ...1 args... )
user/themes/charcoal-kobak/tag.php line 25:
  Post->__get( ...1 arg... )
system/classes/rawphpengine.php line 93:
  include( ...1 arg... )
system/classes/theme.php line 504:
  RawPHPEngine->display( ...1 arg... )
system/classes/theme.php line 127:
  Theme->display( ...1 arg... )
system/classes/theme.php line 263:
  Theme->display_fallback( ...1 arg... )
system/classes/theme.php line 388:
  Theme->act_display( ...1 arg... )
system/classes/userthemehandler.php line 50:
  Theme->act_display_tag( )
system/classes/controller.php line 167:
  UserThemeHandler->act( ...1 arg... )
index.php line 221:
  Controller::dispatch_request( )
---

Plugins:

Aliencontact
audioscrobbler
coredashmodules
deliciousfeed
feedburner
flickrfeed
flickrmedia silo
google analytics
habari media silo
site maps
spam checker
technorati
thickbox
twitter
viddler media silo

Ali B.

unread,
Aug 16, 2008, 9:42:06 PM8/16/08
to habari...@googlegroups.com
Ok, this was a tough one :)

I was able to find out where the problem is, however, I was not able to "zero in" on it as it seems to be a regex issue and that is beyond my knowledge.

The problem with that post is the combination of the "less than" character "<" and the space character that comes before it. The Fomrat::summary function is dealing with that character in a strange way where it detects it as a word and then as an html tag but does not actually return anything to the $tagn array (the size of the array remains 0), which is causing the error that you see when the code is trying to retrive $tagn[1].

This is actually reproducible when you have the word count passed to the post_content_out filter big emough for the summary function to attempt to include that in the post excerpt (ie. it's not only in the tags view, but it will occure whenver the theme attempts to display the excerpt of that particular post).

As I mentioned, the regex's are beyond my knowledge, but I will open a ticket for this issue. Meanwhile, for your particular case, using the html code for that character (&lt;) should take care of it. Having said that, I don't know if you should use bare < or > in the post even if they are wrapped up with the <code> tag.

Hope that helps

Balazs Koren

unread,
Aug 17, 2008, 6:02:10 AM8/17/08
to habari...@googlegroups.com
Thank you!!! It worked. 

Balazs
Reply all
Reply to author
Forward
0 new messages