Repository navigation
fix: reject special characters in DB_DATABASE to prevent reinstall fa… - #405
Merged
navneetkumar-pim-webkul merged 3 commits intoMay 26, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents failed reinstalls caused by MySQL identifier-quoting when DB_DATABASE contains special characters (notably dots), by validating the database name during the interactive installer flow and adding coverage for the new behavior.
Changes:
- Add
DB_DATABASEvalidation in the installer to only allow[A-Za-z0-9_](trimmed), failing early with a clear validation message. - Add Pest feature tests asserting rejection of dotted/dashed DB names and acceptance of an underscore-containing name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/Webkul/Installer/src/Console/Commands/Installer.php | Adds validation/transform logic for DB_DATABASE during unopim:install prompts to block problematic characters. |
| packages/Webkul/Installer/tests/Feature/DatabaseNameValidationTest.php | Introduces feature tests covering invalid/valid DB_DATABASE values during installation. |
…l-chars-in-db-name # Conflicts: # packages/Webkul/Installer/src/Console/Commands/Installer.php
dripar-webkul
commented
May 26, 2026
dripar-webkul
left a comment
Collaborator
Author
There was a problem hiding this comment.
conflict fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1.2.3) fails onmigrate:freshwithSQLSTATE[42000] ... near '.\3`.`admin_password_resets`.... Root cause: Laravel's MySQL grammar wraps each dot-separated segment of a qualified identifier in backticks, so1.2.3.tablenamebecomes ``1.2.3.tablename` `` — parsed as a 4-segment identifier.CREATE TABLEdoesn't qualify the table with the DB name; the bug only surfaces on reinstall whenDROP TABLE wk_db.tableis generated.DB_DATABASEat install time, rejecting anything outside[A-Za-z0-9_]. Same rule already enforced forDB_PREFIX. Users see a clear error instead of a half-installed state that breaks the next install.Test plan
vendor/bin/pest packages/Webkul/Installer/tests/Feature/DatabaseNameValidationTest.php— 3 new tests (rejects1.2.3, rejectsmy-db, acceptsunopim_v2)vendor/bin/pest --testsuite="Installer Feature Test"— 30 passed (115 assertions), no regressions1.2.3at the DB name prompt now shows the validator error; enteringunopimworks as before.Closes #862