BUG? Extra brackets getting added to concrete.php overrides

Permalink
V8.2...

Every so often the site goes down totally and I have to look in the Apache error log to find the issue which unless I've broken something is usually:
PHP Parse error:  syntax error, unexpected ']', expecting end of file in /var/www/tog/concrete5-8.1.0/application/config/generated_overrides/concrete.php on line 76


With the issue being extra array brackets being added into concrete.php. I'm not touching this file at all (except to delete these brackets.
69             'enabled' => true,
 70             'validate_email' => false,
 71             'notification' => null,
 72             'notification_email' => false,
 73         ],
 74     ],
 75 ];
 76       ], <------------- these
 77     ], <-------------
 78 ]; <-------------


The only thing manipulating this file is this in the package controller
public function on_start() {
        \Route::setThemeByRoute('/login', 'tog_main');
        \Route::setThemeByRoute('/register', 'tog_main');
        \Route::setThemeByRoute('/page_not_found', 'tog_main');
        \Route::setThemeByRoute('/dashboard/welcome', 'tog_main');
        // override dash RHS panel
        $objEnv = Environment::get();
        $objEnv->overrideCoreByPackage('elements/panels/dashboard.php', $this);
        $objEnv->overrideCoreByPackage('views/panels/add.php', $this);
        //
        // override marketplace, welcome popup, etc
        \Config::save('concrete.marketplace.enabled', false);
        \Config::save('concrete.marketplace.intelligent_search', false);
        \Config::save('concrete.external.intelligent_search_help', false);
        \Config::save('concrete.external.news_overlay', false);


I did a package upgrade today when I added a block to it but I couldn't say that package updates consistently caused this issue. It's happen maybe 3-4 times over the course of building this package (3 months) though there's not one specific thing I could say causes this to happen.

Should this be logged as a bug or am I doing something wrong somehow? Thought it best to run it past the community before logging it.

surefyre
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi surefyre,

I would see if you can find a pattern and document the steps to reproduce the issue.

On a test setup, install and uninstall the package repeatedly to see when, and if, the issue occurs.
mnakalay replied on at Permalink Reply
mnakalay
Sorry, please disregard my previous post, I misunderstood what was happening. I deleted it.
stephendmalloy replied on at Permalink Reply
stephendmalloy
This happened to met today, except in the application/config/generated_overrides/app.php - concrete5 seems to have added and extra:

);


To the array that's generated and caused the site to crash. I have no idea why this is happening. Only occurs every once and a while. I've also had it happen on one other site as well. I tried to figure out why but had no luck. Any ideas?
surefyre replied on at Permalink Reply
surefyre
Just happened again on another production site, bringing it down completely. Last line of the php file had the closing square brackets duplicated and needed to be deleted.

I assume the install and upgrade methods of the package controller don't get run every time, just the on_start() which in my case contains some defines plus:
\Config::save('concrete.email.validate_registration.address', 'noreply@mysite.co.uk');
\Config::save('concrete.email.validate_registration.name', 'My site name');
\Route::setThemeByRoute('/login', 'debs');
\Route::setThemeByRoute('/register', 'debs');
\Route::setThemeByRoute('/page_not_found', 'debs');
\Route::setThemeByRoute('/dashboard/welcome', 'debs');
\Route::setThemeByRoute('/login/callback/concrete/email_validated', 'debs');
surefyre replied on at Permalink Reply
surefyre
I just posted a bug report as it seems to need addressing still.

https://www.concrete5.org/developers/bugs/8-4-2/extra-square-bracket...
JohntheFish replied on at Permalink Reply
JohntheFish
Things like this are best reported as issues on GitHub. Bug reports on this site have a very low profile while issues do get attention.
jerryscott replied on at Permalink Reply
jerryscott
Have we found a solution yet for this? I have been experiencing the exact same issue.
stephendmalloy replied on at Permalink Reply
stephendmalloy
Sadly, I can't find where, but someone did post a solution that worked for me. Essentially, if you are calling Config::save in a package on_start method is causes a race condition which leads to this issue. Instead, use Config::set and the problem should go away.