Broken regex in /console/lithium.php - Bugfix #681

Speedrockracer opened this Issue Nov 16, 2012 · 4 comments


None yet
3 participants

Hey guys,

The regex around line 91

if (preg_match("/^define(["']LITHIUM_LIBRARY_PATH["']/m", file_get_contents($path))) {

Wil never return true.

I think it sould be:


This way the console command can use the normal bootstrap.



nateabele commented Nov 16, 2012

I'm not sure what you're talking about. The regex is intended to match this line:, which it does.

@nateabele nateabele closed this Nov 16, 2012

Oh my bad I Didn't notice the "m" @ the end.
Anyway it didn't match on my end because my code goes like this:

if(isset($_SERVER['LITHIUM_LIBRARY_PATH'])){ // take from the apache config
}else{ // command line fallback
define('LITHIUM_LIBRARY_PATH', '/var/lib/lithium/libraries');

Notice the tabs in front. Removing them solved my issue.
My question: Is this bad practice?



nateabele commented Nov 19, 2012

My question: Is this bad practice?

Not really, no. Those files are intended to be user-configurable, and what you're doing is a perfectly legitimate way to configure an application. I think what we can do is change the regex to look like this, which should solve your issue:


@nateabele nateabele reopened this Nov 19, 2012


davidpersson commented Jan 8, 2014

Thanks for bringing this to our attention, @Speedrockracer. The issue has been fixed in 2e9baae.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment