This one is part of META issue #1931138: Fixing all 'single marker' issues

Around gmap.module, line 555, i get warnings sometimes cause permissions are wrong on gmap_markers.js file. When that occurs, $file is false, so accessing $file->fid is wrong. May be is necessary to catch that kind of error and show a better error message. For example:

// Make sure js/ exists in the files folder.
if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
$file = file_save_data($contents, 'public://js/gmap_markers.js', FILE_EXISTS_REPLACE);
if ($file === false)
drupal_set_message(t('GMap is unable to save the marker bundle. Please check gmap_markers.js permissions!'), 'error');
else
variable_set('gmap_marker_file', $file->fid);
}
else {
drupal_set_message(t('GMap is unable to save the marker bundle. Markers will not work!'), 'error');
}

Comments

zoen’s picture

Agreed. Lack of permissions to save gmap_markers.js made my site all errory too. Javier's proposed solution didn't work for me, though - the file_save_data() fail on line 554 made my page error out with Unexpected Error badness. I guess that's what the file_prepare_directory() call is supposed to check for. Evidently it needs more checking.

wojtha’s picture

Status: Active » Needs review
StatusFileSize
new611 bytes
wojtha’s picture

StatusFileSize
new1.39 KB

Better error message incl. watchdog.

hutch’s picture

You might want to stop it regenerating the title markers as well on fail (while your'e on a patching roll).

podarok’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Needs work

#3

 git apply --check 1167594-3_saving_gmap_markers.patch
warning: gmap.module has type 100755, expected 100644
error: patch failed: gmap.module:547
error: gmap.module: patch does not apply

needs reroll against latest dev

podarok’s picture

Issue summary: View changes

Updated issue summary.

max-kuzomko’s picture

Assigned: Unassigned » max-kuzomko
Issue summary: View changes
max-kuzomko’s picture

Issue tags: +dcuacs2015, +DrupalCampUA, +codesprint, +2015
max-kuzomko’s picture

Status: Needs work » Needs review
StatusFileSize
new1.36 KB

Fixed #5

valentine94’s picture

Status: Needs review » Reviewed & tested by the community

Great - RTBC!

The last submitted patch, 2: 1167594_saving_gmap_markers.patch, failed testing.

The last submitted patch, 3: 1167594-3_saving_gmap_markers.patch, failed testing.

podarok’s picture

Status: Reviewed & tested by the community » Fixed

thanks, merged

  • podarok committed 6f6fb86 on 7.x-2.x authored by max-kuzomko
    Issue #1167594 by wojtha, max-kuzomko, Valentine94: Saving gmap_markers....

Status: Fixed » Closed (fixed)

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