I am now upgrading my Laravel app from 5.8 to 8.
The problem: PHP 7.4 (and 7.3), required for Laravel 8 app, does not accept non-existing variable in the 'compact()'. It'd take hours to rework my code's logic.
In my opinion the problem lies in the design philosophy of the PHP development team. They disregard the fact that php apps built by people like us handle non-existent variables in views or controller logic. Therefore they impose code cleanliness
over user-control.
My question:
Is there a solution, such as
- A
lcompact
workaround. - A crude hack of adding
$variable = null;
in my controller methods. - or hacking the framework code as here https://stackoverflow.com/a/59692651/4209866
(The answer doesn't work in Laravel 8, as the
addWhereExistsQuery
does not have theoperator
parameter.)
Thank you.