I didn't checked settings.php file. I switched to php 5.6, made the edits, than switched back to php 7.2. Settings were saved in this way
OK .... well from reading my guess is that the check we do
if (function_exists('opcache_invalidate'))
is not sufficient and has a couple of bugs. First the function existing does not mean that you are using the opcache. Second even if it exists, it does not mean we can use it.
So I'm thinking we need to change that to be
if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') && stripos(BOARDDIR, ini_get('opcache.restrict_api')) !== 0)
Which checks that the extension is available, that we have enabled it and that we are not restricted from using certain functions (like opcache_invalidate). This will prevent the error HOWEVER you will still have the cache issue as the cache is using the old file for "some time" based on the values you are running the opcode under.