I got the following error when loading a D7 site with Geofield enabled
Deprecated: Required parameter $map_name follows optional parameter $defaults in ...\sites\all\modules\geofield\geofield.widgets.openlayers.inc on line 302

Comments

frank.schram created an issue. See original summary.

andregp’s picture

Assigned: Unassigned » andregp

I'll work on a patch

andregp’s picture

Version: 7.x-2.3 » 7.x-2.x-dev
Issue tags: +Novice, +Coding standards

It's a simple manner of placing the optional parameter at the end of the function parameters to follow Drupal coding standards. Ths issue is also on the dev branch.

andregp’s picture

Assigned: andregp » Unassigned
Status: Active » Needs review
StatusFileSize
new1.16 KB
frank.schram’s picture

Patch #4 solves the error. Thank you!

Matheus Macario’s picture

Assigned: Unassigned » Matheus Macario
Status: Needs review » Reviewed & tested by the community

Changing the issue status, once the patch #4 already solves the error.

Matheus Macario’s picture

Assigned: Matheus Macario » Unassigned
alina.basarabeanu’s picture

Patch #4 works on Drupal core 7.91, PHP 8.0.21 and Geofield 7.x-2.4 version
Is there any chance to get merged into dev or a new stable release for Drupal 7?

ronino’s picture

#4 works for me, thanks!

poker10’s picture

Status: Reviewed & tested by the community » Needs work

Patch #4 is an API change. I do not think this is the best solution. I think that changing this:

function openlayers_geofield_form_latlon_map($defaults = array(), $map_name) {

to this:

function openlayers_geofield_form_latlon_map($defaults = array(), $map_name = '') {

could be a more safer way to do. And also if we check the openlayers_map_load() function, where the $map_name parameter is passed, it already defaults to empty string, so it seems good to me. See: https://git.drupalcode.org/project/openlayers/-/blob/7.x-2.x/openlayers.module#L827

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new1.33 KB
new1.61 KB

Updated patch #4 by addressing #10, please review it.

Thanks!

roberttabigue’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new432.16 KB
new198.35 KB

Hi,

The Geofield works for me when enabled without applying the patch against the Drupal core version of 9.5.6 and PHP 8.0.

See the attached screenshots for reference.

  • poker10 committed d80b1e80 on 7.x-2.x authored by mrinalini9
    Issue #3254220 by mrinalini9, andregp: Deprecated: Required parameter $...
poker10’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone, committed!

@roberttabigue - this issue is for 7.x-2.x version of the module (e.g. Drupal 7, not Drupal 9/10). It does not seems to affect 8.x-1.x branch.

Status: Fixed » Closed (fixed)

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