jasonlewis / basset

A better asset management package for Laravel.
http://jasonlewis.me/code/basset
240 stars 76 forks source link

basset:publish Error on Development Branch #168

Closed jallits closed 11 years ago

jallits commented 11 years ago

php artisan basset:publish foundation

{"error":{"type":"ErrorException","message":"preg_replace(): Unknown modifier 'r'","file":"\/vendor\/jasonlewis\/basset\/src\/Basset\/Factory\/AssetFactory.php","line":112}}

I believe this is caused because forward-slashes are being used as your regex pattern delimeter. Swapping out for another character such as the tilde (as shown below) should work.

$path = preg_replace('/^'.preg_quote($this->publicPath).'/', '', $path);

replace with

$path = preg_replace('~^'.preg_quote($this->publicPath).'~', '', $path);
jasonlewis commented 11 years ago

Ah good pick up. I'll add the slash as the second parameter to preg_quote On 14 Jun 2013 01:37, "Daniel Craig Jallits" notifications@github.com wrote:

php artisan basset:publish foundation

{"error":{"type":"ErrorException","message":"preg_replace(): Unknown modifier 'r'","file":"\/vendor\/jasonlewis\/basset\/src\/Basset\/Factory\/AssetFactory.php","line":112}}

I believe this is caused because forward-slashes are being used as your regex pattern delimeter. Swapping out for another character such as the tilde (as shown below) should work.

$path = preg_replace('/^'.preg_quote($this->publicPath).'/', '', $path);

replace with

$path = preg_replace('~^'.preg_quote($this->publicPath).'~', '', $path);

— Reply to this email directly or view it on GitHubhttps://github.com/jasonlewis/basset/issues/168 .

jasonlewis commented 11 years ago

Pushed a possible fix for this.

jallits commented 11 years ago

Looks good to me.