WebUI: nginx + php 7.3 Error in: laravel/framework/src/Illuminate/Database/Query/Builder.php:1229

The error i see sometimes is:
Whoops, looks like something went wrong. Check your librenms.log.

Check your log for more details. (librenms.log)

The error from librenms log:
[2018-12-22 14:26:04] production.ERROR: ErrorException: compact(): Undefined variable: operator in /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:1229
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, ‘compact(): Unde…’, ‘/mon/librenms/v…’, 1229, Array)
#1 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1229): compact(‘type’, ‘operator’, ‘query’, ‘boolean’)
#2 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1179): Illuminate\Database\Query\Builder->addWhereExistsQuery(Object(Illuminate\Database\Query\Builder), ‘and’, true)
#3 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1203): Illuminate\Database\Query\Builder->whereExists(Object(Closure), ‘and’, true)
#4 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1254): Illuminate\Database\Query\Builder->whereNotExists(Object(Closure))
#5 /mon/librenms/app/Models/Notification.php(87): Illuminate\Database\Eloquent\Builder->__call(‘whereNotExists’, Array)
#6 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(934): App\Models\Notification->scopeIsUnread(Object(Illuminate\Database\Eloquent\Builder), Object(App\Models\User))
#7 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1247): Illuminate\Database\Eloquent\Builder->callScope(Array, Array)
#8 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1374): Illuminate\Database\Eloquent\Builder->__call(‘isUnread’, Array)
#9 /mon/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1386): Illuminate\Database\Eloquent\Model->__call(‘isUnread’, Array)
#10 /mon/librenms/app/Checks.php(80): Illuminate\Database\Eloquent\Model::__callStatic(‘isUnread’, Array)
#11 /mon/librenms/app/Http/Controllers/LegacyController.php(11): App\Checks::postAuth()
#12 [internal function]: App\Http\Controllers\LegacyController->index(’’)

./validate.php

Component Version
LibreNMS 1.46-87-gc2e52cfab
DB Schema 275
PHP 7.3.0-2
MySQL 10.1.37-MariaDB-3
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.8.0
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

OS: Debian buster (testing)
Web server: nginx/1.14.2
PHP: 7.3.0-2

I just switched from apache to nginx, and the error only occur random which is quite odd. But the error posted from the librenms log is happening quite frequently.

Any assistance would be greatly appreciated.

1 Like

Laravel 5.4 has a bug that makes it incompatible with PHP 7.3. Because we have to support PHP 5.6 right now we can’t use a newer version of Laravel.

Laravel caches pages so it doesn’t always hit the bug.

Okay, I’ll install php 7.1/7.2 besides 7.3 and see if I can get it to play nice.

Thanks for the information.

This should fix it:

cd vendor/laravel/framework
wget https://patch-diff.githubusercontent.com/raw/laravel/framework/pull/25193.diff
patch -p1 < 25193.diff
3 Likes

That did the job, thanks @murrant

Had the same issue with php 7.3. Fix worked fine, thanks

Worked like magic. Thanks!

You should not be running older versions of LibreNMS any more. Update to 1.50.1 or the current master.