Unescaped regex....
joeyhub opened this issue · comments
Joey commented
ErrorException : preg_replace(): Unknown modifier '/'
at /dev/urandom/vendor/krlove/eloquent-model-generator/src/Processor/RelationProcessor.php:303
299| * @return string
300| */
301| protected function removePrefix($prefix, $tableName)
302| {
> 303| return preg_replace("/^$prefix/", '', $tableName);
304| }
305| }
306|
Should be just string ops or preg_quote.
Andrii Mishchenko commented
@joeyhub can you provide examples of prefix
and tableName
which could help me reproduce the issue? Thanks
Joey commented
In MySQL the backtick used to enquote identifiers allows all kinds of characters.
For example:
SELECT `key` FROM `world/timezones`;
I'm not sure how it works in all cases but it's entirely possible to have regex characters in identifier names.
The same will apply to the prefix, for example, app/
as a prefix contains a character that has special meaning in PHP regex.
Andrii Mishchenko commented
Thank you for making it clear. Issue is fixed in version 1.3.4