With the 4.6.0 release candidate and the CVS version of the event module (as of about an hour ago) I am getting this error:

warning: implode(): Bad arguments. in /web/blufftontoday.com/htdocs/includes/theme.inc on line 435.

... on /event/search
/node when I attempt to view any event or any aggregation containing events (one error per event)
/node/add/event (preview)

The calendar display in /event seems to work just fine.

CommentFileSizeAuthor
#5 phptemplate_links_bug.patch3.13 KBTDobes

Comments

pancho’s picture

I can reproduce this bug, but interestingly only with the 'friendselectric' theme. In all other themes there is no error showing up. At the moment I have no idea how to solve this (and no time), but the friendselectric hint helps...?

yelvington’s picture

I'm not using friendselectric; I'm using a built-from-scratch theme running on the phptemplate engine. There's nothing tricky/special in my templates, so whatever exposes the problem is deeper in the system.

pancho’s picture

Assigned: Unassigned » pancho

Okay, seems like I found out the problem...

In the 'event_view' method on line 386 event.module calls 'theme_node' in theme.inc.
The latter calls 'phptemplate_node' in phptemplate.engine.
This again calls the theme defined method 'phptemplate_links'.

Ok now. The problem is that 'phptemplate_links' is not handed over the proper variable $links. It is empty and therefore no array, which causes the "implode(): Bad arguments." error.

The problem seems to be only with phptemplate-based themes, so we could add an is_array check in the template.php which in fact works (tested it, too). On the other side we can't and shouldn't check everything for validity.

So I'd prefer tackling the problem there where it comes from: event.module calls a method without parsing the necessary arguments. Why does it call the method at all? I couldn't figure that out, maybe someone from the developer team knows.

In fact, the problem is resolved if I comment out the complete line 386. The returned argument seems not to be needed as everything worked perfectly (I tested all functions and with different themes).

So for now the solution is: comment line 386 out. ('return theme('node', $node, $main, $page);' in 'function event_view'.

In the meantime I'm asking the developer team for the reason why the method is being called, and if there is none: Please update the CVS version with patch 18600, patch 18619 and this one. Even if there is a completely new version of event.module to come in some weeks, please file this version of event.module as 4.6.0 ready module in the download area. It seems to be absolutely 4.6.0 ready, and some weeks are a time. Thanks!

pancho’s picture

Title: bad arguments in theme.inc » implode(): Bad arguments in theme.inc
TDobes’s picture

Project: Event » PHPTemplate
Assigned: pancho » TDobes
StatusFileSize
new3.13 KB

This is not a event.module bug. This is not a friendselectric bug. This is a phptemplate bug. and it was just re-broken recently.

The problem is in the function phptemplate_node (in phptemplate.engine).
The line which calls theme('links') does not check to make sure that $node->links is populated... it just blindly passes it along to the theme('links') function, which then causes the error. The solution to this problem is to follow the same syntax that the theme_node from core uses. We should replace the line that reads:

      'links'          => theme('links', $node->links),

with

      'links'          => $node->links ? theme('links', $node->links) : '',

The corrected line calls theme('links') iff there are actually links to display, avoiding errors like this.

This problem can be reproduced with a clean Drupal install (phptemplate and a phptemplate-based theme only) by creating a node that will have no links (i.e. commenting disabled, no "read more").

Adrian:
I have attempted to fix this twice, (one, two)
but upon both occasions the fixes have been wiped out by your commits. Please fix this problem in one way or another and commit the change.

I have attached a patch which you may use if you wish. It also removes a confusing comment that no longer applies (the multisite patch has landed... lines no longer need replacing), adds a $Id$ tag to bring phptemplate into conformance with the contrib CVS coding standards, and cleans up a bunch of whitespace.

adrian’s picture

Thank you for the patch. I will apply it shortly.

I wasn't aware that I had overridden your commits. I humbly apologize.

adrian’s picture

committed.

TDobes’s picture

Thanks Adrian. I know I should have submitted a patch a while back, but sometimes "cvs commit" is easier. :-)

Anonymous’s picture