Closed vedranmiletic closed 3 years ago
Where are you getting this as the const is always defined: https://github.com/getgrav/grav/blob/develop/system/defines.php#L45
Upon attempting to load any page.
Have you modified the files? Check the contents of the above file, it should match what you have in your local.
No, I have not. That file looks exactly the same. I have added the stack trace below, hope it helps.
Stack frames (10):
9
Whoops\Exception\ErrorException
…/user/plugins/problems.new/classes/Problems/EssentialFolders.php31
8
Grav\Common\Debugger deprecatedErrorHandler
…/user/plugins/problems.new/classes/Problems/EssentialFolders.php31
7
Grav\Plugin\Problems\EssentialFolders process
…/user/plugins/problems/classes/Problems/Base/ProblemChecker.php88
6
Grav\Plugin\Problems\Base\ProblemChecker check
…/user/plugins/problems/problems.php128
5
Grav\Plugin\ProblemsPlugin problemsFound
…/user/plugins/problems/problems.php47
4
Grav\Plugin\ProblemsPlugin onFatalException
…/vendor/symfony/event-dispatcher/EventDispatcher.php264
3
Symfony\Component\EventDispatcher\EventDispatcher doDispatch
…/vendor/symfony/event-dispatcher/EventDispatcher.php239
2
Symfony\Component\EventDispatcher\EventDispatcher callListeners
…/vendor/symfony/event-dispatcher/EventDispatcher.php73
1
Symfony\Component\EventDispatcher\EventDispatcher dispatch
…/system/src/Grav/Common/Grav.php556
0
Grav\Common\Grav fireEvent
…/index.php63
I have no idea how Grav can run but problems cannot as both use the same constant. The defines file is loaded by autoloader way before anything else and is required to bootstrap Grav.
Basically, it looks like it's defined before plugins run, but somehow doesn't work in plugin anymore, which is impossible (constants cannot be unset or updated) unless there's either a bug in PHP or your Grav installation has a mixed set of files from multiple versions.
Can you check this line, as it's being run before any plugins and should fail, too: https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Config/Setup.php#L167
How can I do that?
FWIW, I added at the beginning of the file:
define('GRAV_SYSTEM_PATH', '/var/www/example.com/system');
define('GRAV_WEBROOT', '/var/www/example.com/html');
And everything works now. So these are the only two constants that don't get defined for some reason.
The first path should be just 'system'
. I really cannot see them not being defined unless the define.php
isn't being called or if it is the old version of the file. Did you try to reinstall Grav?
I did and it didn't help.
Do you want me to try to bisect this?
After playing with it for some time going back and forward, it seems that clearing OPcache by restarting PHP-FPM, which I randomly thought of, actually did the job. (FWIW I cleaned Grav cache on every version change.) Everything works now. Thanks for your help and apologies for wasting your time. Keep up the good work!
I'm wondering why opcahe wasn't cleared when Grav was updated -- the installation process contains a call to clear the opcache. Grav cache also automatically clears when you install updates.
I had the same issue running bin/grav install
on a Grav 1.6.31 install. Our server is only running PHP 7.2 so we couldn't install yet Grav 1.7, which the latest version of the problems plugin requires (as of April 2021). I'm instead manually installing problems 2.0.3 to resolve this.
(To install 2.0.3, use direct-install
command available in bin/gpm
, eg: bin/gpm direct-install https://getgrav.org/download/plugins/problems/2.0.3
)
The latest version of the problems plugin requires Grav 1.7, not sure why the installer didn't stop the installation.
Yes @mahagr that's what I'm saying as well. Looks like the installer is not correctly checking software versions before installing. When trying to install other plugins the bin/gpm
tool has a red error message stating it can't proceed due to missing requirements. I'm not sure where it checks those dependencies -- maybe composer? Probably a simple fix.
PHP 7.4.16 Grav 1.7.12 Problems 2.1.1
The code shown in the stack trace is:
Everything works if I revert to Problems 2.0.3.