Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
Speedrockracer opened this Issue · 4 comments

3 participants

@Speedrockracer

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:

"/define([\"']LITHIUM_LIBRARY_PATH[\"']/m"

This way the console command can use the normal bootstrap.

Grtz
Speedrock

@nateabele
Owner

I'm not sure what you're talking about. The regex is intended to match this line: https://github.com/UnionOfRAD/framework/blob/master/app/config/bootstrap/libraries.php#L62, which it does.

@nateabele nateabele closed this
@Speedrockracer

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
define('LITHIUM_LIBRARY_PATH', $_SERVER['LITHIUM_LIBRARY_PATH']);
}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?

Greetz,
Speedrock

@nateabele
Owner

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:

"/^\s*define\([\"']LITHIUM_LIBRARY_PATH[\"']/m"

@nateabele nateabele reopened this
@davidpersson
Owner

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
Something went wrong with that request. Please try again.