Laravel 4.1 handles ambiguous routes differently than 4.0

After upgrading from Laravel 4.0 to 4.1 some of my routes mysteriously stopped working. It turns out I had some ambiguity in my routes and how those ambiguities are handled changed in 4.1.

My 4.0 setup looked like this:

Route::get('file/{file}.mp3', 'FileController@mp3');
Route::get('file/{file}', 'FileController@show');

Since the {file} wild card is not completely separated by slashes, requests for the first route could be matched by the second route. In 4.0, I had to have them in this order for mp3 requests to be matched correctly.

In Laravel 4.1 the matching order must have changed, because mp3 requests were being matched by the generic file route. Putting the mp3 route after the generic file route seemed to fix the problem.

Ultimately, I decided that I shouldn’t be depending on how Laravel handles ambiguous routes, so I changed the mp3 route to file/mp3/{file}.mp3 which behaves correctly independent of the order.

Update: (Dec 5th, 2013) I sent a tweet to @laravelphp asking if this was a known change. It was a bug, and has been fixed in the most recent version.