framework: Resource route length > 32 characters throws preg_match() errror.
When I try to delete a specified resource using a uri that is greater than 32 characters the following error is encountered:
Warning: preg_match(): Compilation failed: subpattern name is too long (maximum 32 characters) at offset 80 in C:\apps\grahamsqbapi\bootstrap\compiled.php line 15188
My defined route:
// "salesorderlinedetaildepartmentemployees" is used to match the table name (gotta love quickbooks..)
Route::resource('salesorderlinedetaildepartmentemployees', 'Api_SalesOrderLineDetailDepartmentEmployeeController', array('only' => array('index', 'destroy')));
If I shorten “salesorderlinedetaildepartmentemployees” to “salesorderlinedetaildepartmentem” everything executes just fine.
Requested solution: Extend how long the resource route uri can be.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 15 (9 by maintainers)
This issue still exists in Laravel 5.1.10.
When using long resource names, the
ResourceRegistrar::getResourceWildcard()
method can return strings which exceeds 32 characters, resulting in the same error as above. The only workarounds are to adjust the resource name (making it less descriptive) or manually adding routes and use a custom placeholder like$x->get(
my-really-really-really-really-long-route-name-here/{customShortPlaceholder}‘, \App\Http\Controllers\XxController@xx’);`It would be nice to be able to set the preferred placeholder names in the resource options and/or making the
getResourceWildcard()
method handle these cases differently.Just putting this here instead of creating a new issue directly to check if it’s something that will be fixed as it has been in since L4.