-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: PHP Warning when trying to remove action dokan_seller_reg_form_fields
#2285
Fix: PHP Warning when trying to remove action dokan_seller_reg_form_fields
#2285
Conversation
…merce_register_form’, ‘dokan_seller_reg_form_fields’ ); `
WalkthroughThe Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant RegistrationForm
participant Registration
User->>RegistrationForm: Fills registration form
RegistrationForm->>Registration: Submits form with role
Registration->>Registration: validate_registration()
alt Role is empty or invalid
Registration-->>RegistrationForm: Return error
else Role is valid
Registration-->>RegistrationForm: Proceed with registration
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
includes/Registration.php (1)
Line range hint
148-149
: Sanitize the input from$_POST['dokan_address']
and$_POST['phone']
to prevent security vulnerabilities.- $dokan_settings['address'] = isset( $_POST['dokan_address'] ) ? wc_clean( wp_unslash( $_POST['dokan_address'] ) ) : ''; - $dokan_settings['phone'] = isset( $_POST['phone'] ) ? dokan_sanitize_phone_number( wp_unslash( $_POST['phone'] ) ) : ''; + $dokan_settings['address'] = isset( $_POST['dokan_address'] ) ? sanitize_text_field( wp_unslash( $_POST['dokan_address'] ) ) : ''; + $dokan_settings['phone'] = isset( $_POST['phone'] ) ? sanitize_text_field( wp_unslash( $_POST['phone'] ) ) : '';
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- includes/Registration.php (1 hunks)
Additional Context Used
GitHub Check Runs (1)
Run PHPCS inspection failure (7)
includes/Registration.php: [failure] 148-148:
Detected usage of a non-sanitized input variable: $_POST['dokan_address']
includes/Registration.php: [failure] 149-149:
Detected usage of a non-sanitized input variable: $_POST['phone']
Additional comments not posted (2)
includes/Registration.php (2)
54-54
: The added check for an empty role is a good enhancement for robustness.
Line range hint
148-149
: The logic for checking and setting address profile completion is well-implemented.
All Submissions:
Changes proposed in this Pull Request:
Fix: PHP Warning when trying to remove action
remove_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields' );
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
Changelog entry
Fix: PHP Warning when trying to remove action
remove_action( 'woocommerce_register_form', 'dokan_seller_reg_form_fields' );
Before Changes
Describe the issue before changes with screenshots(s).
After Changes
Describe the issue after changes with screenshot(s).
Feature Video (optional)
Link of detailed video if this PR is for a feature.
PR Self Review Checklist:
FOR PR REVIEWER ONLY:
Summary by CodeRabbit