Look at comment
I just updated the location module and am getting the following errors:

Error message
Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined index: in location_cck_tokens() (line 628 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined index: in location_cck_tokens() (line 628 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined index: in location_cck_tokens() (line 628 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).
Notice: Undefined index: in location_cck_tokens() (line 628 of /mnt/stor09-wc1-ord1/783602/www..../web/content/sites/all/modules/location/contrib/location_cck/location_cck.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexweber’s picture

Title: location_cck_token() » Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of location_cck.module).
Version: 7.x-3.0-rc6 » 7.x-3.0

Confirmed this happens on 3.0, just upgraded and noticed this too.

alexweber’s picture

Status: Active » Needs review
FileSize
673 bytes

Pretty simple fix from this comment.

alexweber’s picture

Status: Needs review » Needs work

Actually not that simple, going over the code again, we're not stripping [] from the token so $entity has a leading "[" and $field gets a trailing "]".

Also, the code on line 628 triggers an "undefined index" notice, so maybe we should check for array_key_exists before evaluating it.

alexweber’s picture

Status: Needs work » Needs review
FileSize
1.2 KB

Second stab... this one works better.

Went out on a limb with the replacing of square brackets, might be a bad idea, plz correct...

BenStallings’s picture

Status: Needs review » Reviewed & tested by the community

Fix in #4 worked for me! Thanks, alexweber!

Faeton’s picture

After applying the #4 patch, the first notice message still remains:

Notice: Undefined offset: 1 in location_cck_tokens() (line 622 ...

podarok’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
Status: Reviewed & tested by the community » Needs work

due to #6

podarok’s picture

Issue tags: +Needs tests

anybody can reproduce this via tests?

monnerat’s picture

After applying patch #4, I still have a single
Notice: Undefined offset: 1 in location_cck_tokens() (line 622...
Dumping $name and $original shows both variable values are title. Calling explode(':', 'title') gives a single element array, so $field[1] is unset...

zilla’s picture

still getting this error pre-patch (though it works just fine on my site beyond annoying errors text :) - may be worth pushing an update quickly for this one patch before users update this week and start hammering this forum!

Road Runner’s picture

I am also getting these error
Notice: Undefined index: in location_cck_tokens() (line 628 of /home/kitchena/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module).
Also get thiserror with it
Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /home/kitchena/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module).

after update to latest location and latest gmap.
As previously mentioned there seems to be no other site problems except annoying error messages filling log. This seems to occur when I edit a record with or without location enabled.
TIA

tvasilia’s picture

Looks like the revised patch at #4 worked great in my case !
I used it to import a few nodes using feeds with location_cck fields...

Thanks.

jags880’s picture

I tried out #4 and while I still get the "Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of ..."
The other error of "Notice: Undefined index: in location_cck_tokens() (line 628 of ..." is gone.
Anyone else?

MikeCermak’s picture

same here; we've implemented a temporary IF statement to suppress display of those messages, but are awaiting a full fix

Kolo’s picture

Same here.

Bagz’s picture

If it is of any help, the error messages only appear for me when visiting a page for the first time after clearing the cache.

alexweber’s picture

@Bagz that's because token (and most other) hooks get cached and so the error is only thrown when it's rebuilt...

Anyone else wanna take a stab at this?

creeksideplayers’s picture

Version: 7.x-3.x-dev » 7.x-3.1

I'm still having this problem, even after upgrading to 7.x-3.1

podarok’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Issue summary: View changes
Status: Needs work » Postponed (maintainer needs more info)

On Clean install I can`t reproduce this bug
Possible it has data entered dependency and needs upgrade path fixing
So please, can You give us more information about it with full steps to reproduce a bug on clean or working installation with database information
Good to see a SimpleTest test patch with workaround to reproduce
Thanks

zilla’s picture

ditto on 18 above, still getting the issue after most recent update.

Didier Misson’s picture

same problem again, even after upgrade 7.x-3.1.

DrupalHack’s picture

Same.

The error persists after downgrading the back-end back to 7.x-3.dev.
I'm also unable to deactivate the module. If I deactivate from the system table the site won't load.

I'm afraid I'm going to have to delete all location data from the site unless some kind soul works out a patch soon.

Perignon’s picture

Status: Postponed (maintainer needs more info) » Needs review

Patch in #4 works. Applied patch and did thorough cache cleaning and the red-box-of-death seems to have dissappeard

creeksideplayers’s picture

Patch #4 works for me as well. The problem was occurring whenever I added or edited content.

podarok’s picture

Status: Needs review » Fixed

#4 commited pushed to 7.x-3.x
will be tagged for next upcoming release
Thanks!!!

alexweber’s picture

Awesome, thanks!

Gyver06’s picture

Hi,

I confirm still same error as #6. This patch is not yet fully ready as it is. It needs more testing.
Thank you.

podarok’s picture

Title: Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of location_cck.module). » [Needs steps to reproduce] Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of location_cck.module).
Issue summary: View changes

due to #27

podarok’s picture

Issue summary: View changes
Status: Fixed » Needs work

status

podarok’s picture

Issue summary: View changes
podarok’s picture

Issue summary: View changes
Perignon’s picture

@Gyver If you don't preform a clear all cache after you apply the patch you will still see the error. Can you re-attempt the patch and do a thorough cache cleaning afterwards?

Gyver06’s picture

Hi,

I have already cleaned all the cache several times, before and after applying the patch. The error appears when my document is promoted to the front page. Here enclosed is the backtrace of the displayed error if that can help you.
Best regards.

Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /home/monrtier/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module). Backtrace:

location_cck_tokens('entity', Array, Array, Array)
call_user_func_array('location_cck_tokens', Array) module.inc:857
module_invoke_all('tokens', 'entity', Array, Array, Array) token.inc:178
token_generate('entity', Array, Array, Array) token.tokens.inc:810
token_tokens('node', Array, Array, Array)
call_user_func_array('token_tokens', Array) module.inc:857
module_invoke_all('tokens', 'node', Array, Array, Array) token.inc:178
token_generate('node', Array, Array, Array) entity.inc:269
ctools_context_entity_convert(Object, 'title', Array) context.inc:532
ctools_context_convert_context(Object, 'title', Array) context.inc:680
ctools_context_keyword_substitute('%node:title', Array, Array) panels.module:712
panels_display->get_title() PanelizerEntityDefault.class.php:2134
PanelizerEntityDefault->render_entity(Object, 'teaser') panelizer.module:275
panelizer_entity_view_alter(Array, 'node', NULL, NULL) module.inc:1063
drupal_alter(Array, Array, 'node') node.module:1366
node_view(Object, 'teaser', NULL) node.module:2676
node_view_multiple(Array) node.module:2707
node_page_default()
call_user_func_array('node_page_default', Array) pm_existing_pages.inc:125
pm_existing_pages_pm_existing_pages_page(Array)
call_user_func_array('pm_existing_pages_pm_existing_pages_page', Array) menu.inc:517
menu_execute_active_handler() index.php:25

Gyver06’s picture

When I save my document, I get this errors :

Notice: Undefined index: wkt in openlayers_proximity_build_proximity_index() (line 248 of /home/monrtier/public_html/sites/all/modules/openlayers_proximity/openlayers_proximity.module). Backtrace:

openlayers_proximity_build_proximity_index(Object)
call_user_func_array('openlayers_proximity_build_proximity_index', Array) module.inc:857
module_invoke_all('build_proximity_index', Object) openlayers_proximity.module:222
openlayers_proximity_build_node_index(Object) openlayers_proximity.module:43
openlayers_proximity_node_update(Object)
call_user_func_array('openlayers_proximity_node_update', Array) module.inc:857
module_invoke_all('node_update', Object) node.module:1185
node_save(Object) i18n_node.module:465
i18n_node_form_submit(Array, Array) form.inc:1464
form_execute_handlers('submit', Array, Array) form.inc:860
drupal_process_form('ol_locator_location_node_form', Array, Array) form.inc:374
drupal_build_form('ol_locator_location_node_form', Array) node_edit_form.inc:70
ctools_context_create_node_edit_form(, Object, , Array) context.inc:600
ctools_context_create('node_edit_form', Object) node_edit.inc:36
ctools_node_edit_context(Object, Array, ) context.inc:796
ctools_context_get_context_from_argument(Array, Object) context.inc:852
ctools_context_get_context_from_arguments(Array, Array, Array) context-task-handler.inc:333
ctools_context_handler_get_task_contexts(Array, '', Array) node_edit.inc:92
page_manager_node_edit(Object)
call_user_func_array('page_manager_node_edit', Array) menu.inc:517
menu_execute_active_handler() index.php:25

Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /home/monrtier/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module). Backtrace:

location_cck_tokens('entity', Array, Array, Array)
call_user_func_array('location_cck_tokens', Array) module.inc:857
module_invoke_all('tokens', 'entity', Array, Array, Array) token.inc:178
token_generate('entity', Array, Array, Array) token.tokens.inc:810
token_tokens('node', Array, Array, Array)
call_user_func_array('token_tokens', Array) module.inc:857
module_invoke_all('tokens', 'node', Array, Array, Array) token.inc:178
token_generate('node', Array, Array, Array) entity.inc:269
ctools_context_entity_convert(Object, 'title', Array) context.inc:532
ctools_context_convert_context(Object, 'title', Array) context.inc:680
ctools_context_keyword_substitute('%node:title', Array, Array) panels.module:712
panels_display->get_title() PanelizerEntityDefault.class.php:2134
PanelizerEntityDefault->render_entity(Object, 'teaser') panelizer.module:275
panelizer_entity_view_alter(Array, 'node', NULL, NULL) module.inc:1063
drupal_alter(Array, Array, 'node') node.module:1366
node_view(Object, 'teaser', NULL) node.module:2676
node_view_multiple(Array) node.module:2707
node_page_default()
call_user_func_array('node_page_default', Array) pm_existing_pages.inc:125
pm_existing_pages_pm_existing_pages_page(Array)
call_user_func_array('pm_existing_pages_pm_existing_pages_page', Array) menu.inc:517
menu_execute_active_handler() index.php:25

Notice: Undefined offset: 1 in location_cck_tokens() (line 622 of /home/monrtier/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module). Backtrace:

location_cck_tokens('entity', Array, Array, Array)
call_user_func_array('location_cck_tokens', Array) module.inc:857
module_invoke_all('tokens', 'entity', Array, Array, Array) token.inc:178
token_generate('entity', Array, Array, Array) token.tokens.inc:810
token_tokens('node', Array, Array, Array)
call_user_func_array('token_tokens', Array) module.inc:857
module_invoke_all('tokens', 'node', Array, Array, Array) token.inc:178
token_generate('node', Array, Array, Array) entity.inc:269
ctools_context_entity_convert(Object, 'title', Array) context.inc:532
ctools_context_convert_context(Object, 'title', Array) context.inc:680
ctools_context_keyword_substitute('%node:title', Array, Array) panels.module:712
panels_display->get_title() PanelizerEntityDefault.class.php:2134
PanelizerEntityDefault->render_entity(Object, 'teaser') panelizer.module:275
panelizer_entity_view_alter(Array, 'node', NULL, NULL) module.inc:1063
drupal_alter(Array, Array, 'node') node.module:1366
node_view(Object, 'teaser', NULL) node.module:2676
node_view_multiple(Array) node.module:2707
node_page_default()
call_user_func_array('node_page_default', Array) pm_existing_pages.inc:125
pm_existing_pages_pm_existing_pages_page(Array)
call_user_func_array('pm_existing_pages_pm_existing_pages_page', Array) menu.inc:517
menu_execute_active_handler() index.php:25

podarok’s picture

Good to see data given at 622 line of /home/monrtier/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module
backtraces are not friendly for this bug
Can You post here some var_dumps of variables?

podarok’s picture

hiding commited patch

podarok’s picture

here is a debug patch for getting all the data entered foreach block
Can You post here data output after patch applied?

Gyver06’s picture

I have applied #37 patch. How can I get data output to post ?

podarok’s picture

Go to path where Notice invoked and there will be debug data

mripra’s picture

how do i patch without terminal access to me site?
Please help.
Thanks

podarok’s picture

#40 if Your question about patch in #37 - You should manually add one line https://drupal.org/files/issues/2110067-debug-message-do-not-test.patch as You can see here
Previous patches already commited in 7.x-3.x-dev

imoreno’s picture

Hi,
I can confirm that #4 patch did not worked for me. same error are all over the watchdog logs. even after clean all cache files.

Any ideas?

BR
Itzhak

Gyver06’s picture

"Go to path where Notice invoked and there will be debug data"

I am sorry but there is nothing with debug data in the path of the Notice invoqued ie : Notice: Undefined offset: 1 in location_cck_tokens() (line 623 of /home/monrtier/public_html/sites/all/modules/location/contrib/location_cck/location_cck.module)

Any idea ?

Eric.

podarok’s picture

hm (((
Possibly good to get data dump with code dump of Your site for bug fixing... Is it possible?

LeDucDuBleuet’s picture

Patch #4 worked for me over v3.1. Thx!

marc.groth’s picture

For what it's worth, patch in #4 worked for me too. No more unsightly errors (and none in error logs either)

Gyver06’s picture

How can I get data dump of my site, please.

JeroenT’s picture

Status: Needs work » Needs review
FileSize
772 bytes

I made a dump of all the variables, and the $original variable was just 'nid' so when you explode this variable $field[1] doesn't exist. patch attached that checks if $field[1] isset.

Gyver06’s picture

With this last patch, I have no more the error displayed.
Thank you very much for your time.

monnerat’s picture

My own patch version for release 3.1.
It mainly extends #4 in using the token type name as default entity type if a token is not of the form entity:field.
It works for me and suppresses all undefined offset errors. However I would see it tested in situations more complex than my test site...

Status: Needs review » Needs work
podarok’s picture

Status: Needs work » Fixed

#48 commited pushed to 7.x-3.x-dev
Thanks!

monnerat’s picture

Mmmm: IMHO #48 suppress the error, but is not quite right:
If the token value is atokenname, it understands it as token type = atokenname and token name = NULL. atokenname would rather be the token name...

mripra’s picture

how to apply this patch manually?....can some tell me steps to do...i don't have terminal access for my website. Thanks

podarok’s picture

#53 Just write test for error invoke and fix the bug with a new patch

Kolo’s picture

#54 go to your module folder, find location module. Then go contrib>location_cck folder and find file: "location_cck.module". Open it in editor (I use Adobe Dreamviewer).
Then open patch file for example from #48 post (it works for me!) and find what changes that file. You will see which lines change. Find "-" (this lines must be deleted) and "+" (this lines must be added.
Save, clean caches and it should work ;)

mripra’s picture

#56 Ty for reply. but i don't have Location folder in my Module. Can you tell me the path?

I found the path ...its under sites/all/modules..

#52 worked for me. Thanks guys.

yekezei’s picture

Status: Fixed » Needs review

I'm sorry, I'm new and I might have pressed the wrong button.

After applying the patch I still get undefined index: 1 in location_cck_tokens and whatever I fill in the location fields, it doesn't save

imoreno’s picture

#48 did the trick for me, all errors are gone. worked for me.
THX!

podarok’s picture

just upgrade Your module to latest dev version and wait until next upcoming stable release builds

Status: Needs review » Needs work
agoradesign’s picture

just upgrade Your module to latest dev version and wait until next upcoming stable release builds

Normally, the dev versions are automatically(?) built at night after something was committed, but the last dev release is from 2013-Oct-25, although there were some commits pushed in the meantime. Is there something wrong configured?

podarok’s picture

re #62 after drupal.org upgrade from 6 to 7 there are gaps in release cycles - so better way to obtain latest version - grab it via
http://drupalcode.org/project/location.git
Link at right of the screen with "snapshot" text

podarok’s picture

Status: Needs work » Fixed

tagged new beta release for this fix https://drupal.org/node/2129291

zilla’s picture

ran 3.2 beta 1 and error is GONE - thank you @podarok and everybody else who worked on this!

teamA’s picture

Confirmed as fixed on my site. Thanks everyone!

Reg’s picture

Status: Fixed » Needs review
FileSize
1.05 KB

I found that I also got a notice from a couple of lines down. This patch cover that one as well.

Status: Needs review » Needs work

The last submitted patch, 67: location-fix_loation_cck_tokens_notice-2119967-67.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 67: location-fix_loation_cck_tokens_notice-2119967-67.patch, failed testing.

michubu’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
podarok’s picture

Status: Needs work » Closed (fixed)

This issue already fixed and commited
Feel free to open new if any new bug invoked

rolturn’s picture

patch works for me.

erald’s picture

patch #72 works perfectly thanks my logs filled like nuts..

karolus’s picture

#4 worked fine for me, as well.

Strangely enough, I couldn't seem to get into the file via CLI to apply the patch, so did it manually. All operations fine. Will the module proper be updated soon?

agoradesign’s picture

Like podarok already mentioned: this patch is already committed. It's even already included in the 3.2-beta1 release: https://drupal.org/node/2129291

enzo3946’s picture

#72 work for me too!! Great Podarok!!

ShaneOnABike’s picture

Well if it is in the released patch could you deploy that on the frontpage cause you can't actually download it without knowing to go to releases :(

podarok’s picture

re #78
it described in 3.1 release info with a link to 3.2-beta1 fixed
Users not reading release info should do this.
3.2 release coming soon, but beta releases are useful practice and we shouldn`t break it

podarok’s picture

Issue summary: View changes
rick3455’s picture

Patch #4 works for me as well. Awesome...

seehive’s picture

#4 works for me with 3.1

BartraB’s picture

Hello,

I got the same errors to. Maybe it's a kind of dumb question, but where and how do apply the patch? Can I go to Filezilla en manually edited a document?

Thanks for the help.

Greetings,

Bart

agoradesign’s picture

Hi Bart,
best thing is to choose the beta version: https://drupal.org/node/2159879

I don't want to push you, but please read the issue queue more carefully next time, before you ask nearly the same question for the xth time again. It's already mentioned in #76 and #79, that there's a beta version available that includes this bugfix. And also it is mentioned, that the official 3.1 release notes contain a link to the beta release too.

willbxl’s picture

#4 worked fine for me, thank you very much!!!!!

The last submitted patch, 2: location-fix-location-cck-tokens-notice-2119967-2.patch, failed testing.

alessandro rancati’s picture

Locations tokens gave me "Array" as result. Problem gone. Notice gone also. Thank you!

stanoreke’s picture

Patch 4# works great for me. Thanks

GenaT’s picture