Installed version 2 dev today.

Looks good, but there's a small issue, seeing this Notice when working with the clock block configuration:

Undefined index: clock in clock_tokens() (line 50 of /pathToD7/sites/all/modules/clock/clock.tokens.inc).

Comments

tebb’s picture

Hmmm. This is a bit odd.

Now that I have added and deleted some clocks, swapped to the edge module from the table module etc I only seem to see this when I log in to the site.

I can't be clear about what exact changes have happened and when the behaviour changed.

When I navigate to another page and for the rest of the session, there's no message.

If I log out and log back in again, I see the message again.

Is anybody else seeing this?

tstoeckler’s picture

Sorry, but I can't really reproduce your error. If you can find any way to reproduce this, that would be great!

tebb’s picture

StatusFileSize
new562.49 KB

Hi Tobias and thanks for trying.

I get this consistently.

I do not see the notice as anonymous user while browsing the site.

I do see it when submitting the registration form.

I see the notice consistently:

- Twice when I log in.
- Once when I save the logged in user details, for instance after only changing the signature.
- Once when I save the user details without making any changes
- Once when saving changes to pages or articles
etc

I see the notice even if the clock block is excluded from displaying on the page. This seems odd.

I had a look at a back-trace printed to screen using these instructions: http://www.lullabot.com/articles/quick-and-dirty-debugging.

As far as I can see, it just confirms that there is no 'clock' section of the array, but I'll attach it in case it helps.

The back-trace has a label '*Recursion*' near the end of each section of the array. I guess this is normal?

Anything else I can do to trace the issue? I tried disabling entity_cache, but this didn't make any difference.

Unsurprisingly, when I disable the clock module, the issue disappears.

Starminder’s picture

Getting this one also.

cord1’s picture

Notice: Undefined index: clock in clock_tokens() (line 50 of /srv/www/htdocs/DEVTEST/sites/all/modules/clock/clock.tokens.inc).

running
Core 7.x-dev 2011-05-01
clock 7.x-2.x-dev 2011-02-25
( token 7.x-1.x-dev 2011-02-25 )

Everything worked fine until I tested triggers, message when user log in.
Then the above notice came up.

Following var_dumps at line 48 in clock_tokens.inc:
type= string(5) "clock"
tokens= array(1) { ["date"]=> string(12) "[clock:date]" }
data= array(1) { ["clock"]=> object(stdClass)#157 (6) { ["cid"]=> string(1) "1" ["time_zone_type"]=> string(4) "user" ["custom_time_zone"]=> string(3) "UTC" ["date_type"]=> string(4) "long" ["display"]=> string(12) "[clock:date]" ["weight"]=> string(1) "0" } }

SOLUTION:
In line 50 change :
if ($type = 'clock') {
to
if ($type == 'clock') {

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new1.24 KB

Was also missing a break statement int clock_tokens().

Also please consider respecting $options['sanitize'] - see core implementations of hook_tokens() for examples on how to do it.

Starminder’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch is good - thanks!

tstoeckler’s picture

Status: Reviewed & tested by the community » Fixed

Thanks very much for tha patch and your patience, and sorry it took me so long.
Committed to 7.x-2.x.
http://drupal.org/commitlog/commit/12842/74205536b51c27ef584ed6ca65acd02...

@Dave Reid: I will look into $options['sanitize']. I do not yet know how that is relevant here, but I'll find that out :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.