Using 1.x-dev. Geocoding from an Addressfield on the OG Membership Entity. I receive the following error after trying to update the membership. It doesn't seem to affect core node types with the same setup.

Recoverable fatal error: Argument 3 passed to l() must be of the type array, null given, called in /modules/geocoder/geocoder.widget.inc on line 540 and defined in l() (line 2481 of /includes/common.inc).

Any thoughts?

I found similar issues in other contrib modules for reference.

#2315905: Recoverable fatal error: Argument 3 passed to l() must be an array, string given with references_dialog
#1806944: Recoverable fatal error: Argument 3 passed to l() must be an array, null given

The code that the error is referencing:

function geocoder_widget_get_link($entity_type, $entity) {
  $uri_info = entity_uri($entity_type, $entity);
  list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
  $label = t('View offending @entity_type (@bundle # @id)', array(
    '@entity_type' => $entity_type,
    '@bundle' => $bundle,
    '@id' => $id,
  ));
  return l($label, $uri_info['path'], $uri_info);
}

I am going to assume there is something about it being the OG Membership Entity, since we are not experiencing the same with the core content entity.

Comments

nicoz created an issue. See original summary.

pixelsweatshop’s picture

Issue summary: View changes
pifagor’s picture

Status: Active » Needs review
StatusFileSize
new925 bytes

Patch

pifagor’s picture

StatusFileSize
new932 bytes

Add end line

pixelsweatshop’s picture

Status: Needs review » Needs work

Wow. That was fast @pifagor. Thank you.

The patch failed to apply against the 1.x-dev but I manually changed it and the error still persists.

Here is the output of the rejected patch.

***************
*** 532,541 ****
  function geocoder_widget_get_link($entity_type, $entity) {
    $uri_info = entity_uri($entity_type, $entity);
    list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
-   $label = t('View offending @entity_type (@bundle # @id)', array(
-     '@entity_type' => $entity_type,
-     '@bundle' => $bundle,
-     '@id' => $id,
-   ));
-   return l($label, $uri_info['path'], $uri_info);
- }--- 532,543 ----
  function geocoder_widget_get_link($entity_type, $entity) {
    $uri_info = entity_uri($entity_type, $entity);
    list($id, , $bundle) = entity_extract_ids($entity_type, $entity);
+   if (!empty($id) && !empty($bundle)) {
+     $label = t('View offending @entity_type (@bundle # @id)', array(
+       '@entity_type' => $entity_type,
+       '@bundle' => $bundle,
+       '@id' => $id,
+       ));
+     }
+   return !empty($label) ? l($label, $uri_info['path'], $uri_info) : '';
+ }
pol’s picture

As soon as someone reviewed the patch, I'll commit it.

nigelw’s picture

I have tried to apply the patch as well and unfortunately it doesn't work. Still shows Recoverable fatal error: Argument 3 passed to l() must be of the type array, null given

szeidler’s picture

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

I also ran into the issue and it seems, that the affected function was refactored quite drastically.
I applied the hotfix of patch 4 for the current codebase.

It basically happens when

$uri_info = entity_uri($entity_type, $entity);
list($id, , $bundle) = entity_extract_ids($entity_type, $entity);

return NULL values, which are passed into the l() function later on. It's not nice, because we're not logging the watchdog_exception(), but better than having the fatal error.

szeidler’s picture

Maybe this is a cleaner approach, because actually an empty $uri_info causes the error, not the entity ids.

  • Pol committed 9dd3c51 on 7.x-1.x
    Issue #2806741: Recoverable fatal error: Argument 3 passed to l() must...
pol’s picture

Status: Needs review » Fixed

Hi,

Re-rolled and pushed.

pifagor’s picture

Why didn't we add credits to people?

pol’s picture

Hi there,

I usually credit people when the applies without any issue.

In this case, the submitted patch was completely outdated and I did something different in the code.

Don't worry, I always credit people as it should otherwise.

Thanks.

Status: Fixed » Closed (fixed)

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