Template Error after PHP update

After updating PHP on 20-04-2024 I am getting an error from my Ping Latency Template:
Error:
Warning! Fallback template used due to error in template Ping Latency:
Cannot access offset of type string on string (View:
/opt/librenms/storage/framework/views/ac9320ec436bd3d75f6f77f18ce9409e.blade.php)

Template:
Operating System: {{ LibreNMS\Config::getOsSetting($alert->os, ‘text’) }} {{ $alert->version }}
@if ($alert->hardware)
Hardware: {{ $alert->hardware }}
@endif
@if ($alert->location)
Location: {{ $alert->location }}
@endif
Device URL: http://librenms.dssc.nso.edu/device/device={{ $alert->hostname }}/

{{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->description)
@endif
@if ($alert->state == 0)
Time elapsed: {{ $alert->elapsed }}
@endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Ping Average: {{ $alert->ping_avg }}
Ping Loss: {{ $alert->ping_loss }}
Ping Min: {{ $alert->ping_min }}
Ping Max: {{ $alert->ping_max }}
TraceRoute: {{ $alert->debug[‘traceroute’] }}

Any help would be appreciated

I also have the exact same issue after the latest LibreNMS update 24.4.1. Seems like blade.php doesnt like something that existed before the upgrade in the template.

This is the error I see:

Alert sent to: Warning! Fallback template used due to error in template Default Alert Template: Cannot access offset of type string on string (View: /opt/librenms/storage/framework/views/a6099e3adee4123ae46654f428bcb043.blade.php)

Here is my template that is throwing this error:

Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
  {{ $key }}: {{ $value['string'] }}
@endforeach
@endif

@if ($alert->status == 0)
    @if ($alert->status_reason == 'icmp')
        {{ $alert->debug['traceroute'] }}
    @endif
@endif

Whats strange is the error shows “Alert sent to:” in the message. However the alert template “device-template” does NOT have any “Alert sent to:” text in it.

Error Message:

Alert sent to: Warning! Fallback template used due to error in template device-template: Cannot access offset of type string on string (View: /opt/librenms/storage/framework/views/3bfbb67f542ab74cb9c182e1e90695e1.blade.php)

Contents of device-template:

Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
  {{ $key }}: {{ $value['string'] }}
@endforeach
@endif

@if ($alert->status == 0)
    @if ($alert->status_reason == 'icmp')
        {{ $alert->debug['traceroute'] }}
    @endif
@endif

Wonder where is it getting the “Alert Sent To:” from?

Anyone? BUMP

Does not exist at the moment. It was implemented in a way that caused it to be broken with a recent update. No one has contributed a fix yet.

You can remove that line from your template to fix it.

OK thanks,
Seems like there are now some other things broken as well:
Ping Average: ping_avg is not a valid $alert data name
Ping Loss: ping_loss is not a valid $alert data name
Ping Min: ping_min is not a valid $alert data name
Ping Max: ping_max is not a valid $alert data name

Confirmed removing the traceroute code from the template fixed the issue.
Traceroutes were not very useful for our use-case, so not a big deal for us.

Probably should remove the traceroute example config from the Libre alert template documentation if this no longer works.