mysqldump-php
mysqldump-php copied to clipboard
skip-definer doesn't work for views with SQL SECURITY INVOKER
The regex pattern defined in line 1904 (inside TypeAdapterMysql::create_view) fails if the view definition contains "SQL SECURITY INVOKER" instead of "SQL SECURITY DEFINER".
Changing the regex as follows fixes the bug:
Line 1904 before:
.self::DEFINER_RE.'(?:\s+SQL SECURITY DEFINER|INVOKER)?)?\s+(VIEW .+)$/',
Line 1904 after:
.self::DEFINER_RE.'(?:\s+SQL SECURITY (?:DEFINER|INVOKER))?)?\s+(VIEW .+)$/',
The DEFINER|INVOKER
alternation needs to be in its own non-capturing group.
@dweingart Do you plan to create a PR?
We are working on a PR
Even with the Fix, we still see some definers (we are using smilesa/gdpr-dump)
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_abrechnung_letzter_monat`
with skip-definer: true
This happens only for one view