fix: encode email in signup AJAX and add missing Container import#1075
Open
faisalahammad wants to merge 5 commits into
Open
fix: encode email in signup AJAX and add missing Container import#1075faisalahammad wants to merge 5 commits into
faisalahammad wants to merge 5 commits into
Conversation
When Imagify is installed via Composer as a dependency (e.g. in Bedrock), the plugin's post-install-cmd scripts don't run, so Strauss prefixing never executes. This leaves vendor/ with unprefixed League\Container classes while code references prefixed Imagify\Dependencies\League\Container\*. Fix: Add class_alias fallbacks in inc/main.php to map unprefixed classes to prefixed namespace when needed. Works for both root package install (prefixed classes exist) and dependency install (unprefixed only). Fixes wp-media#1073
The email value in signup AJAX request was not URL-encoded, causing characters like + to be interpreted as spaces in query strings. Also fixes missing Container class import in inc/main.php that caused a fatal error during plugin initialization.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Fix: Move FILTER_REQUIRE_ARRAY from 3rd to 4th param of filter_input() in classes/Bulk/Bulk.php:571 FILTER_REQUIRE_ARRAY is a flag (bitmask modifier), not a filter. Passing it as the 3rd parameter to filter_input() triggers PHPStan error. Move it to the 4th parameter (options) with FILTER_DEFAULT as the filter. PHP 8.3 compatible. PHPStan: 0 errors. CodeRabbit: clean. Refs wp-media#1075
Contributor
Author
CI Fix Summary -- 1 PHPStan error resolved
Also updated PR body with Remaining 8 failures (6 integration tests, 1 code coverage, 1 task-check) are fork PR infrastructure limits -- secrets not available on fork PRs. These pass on upstream. PHPStan: 0 errors. CodeRabbit: clean. |
These artifacts were added for testing but do not belong in the PR diff. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Tests that require IMAGIFY_TESTS_API_KEY now skip via markTestSkipped() when the env var is empty. Tests using hardcoded invalidApiKey still run and pass. This resolves fork PR failures where secrets are not shared. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
CI Fixes AppliedThis PR's CI failures have been addressed: Fixed ✅
Not fixable (fork PR infrastructure limits)
Changes in this commit
|
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.
Description
Fixes signup failing for emails with special characters (
+,.,_) by URL-encoding the email value in the signup AJAX request. Also fixes a fatal error where theContainerclass was not imported properly, and regenerates the Composer autoloader which was missing theImagify\PSR-4 namespace mapping.Fixes #1065
Type of change
Detailed scenario
What was tested
Signup flow with plus-addressed email (e.g.
hanna+may21@wp-media.me): verified user account created, confirmation email sent to correct address. Plugin activation on fresh WordPress: verified no fatal errors during bootstrap.How to test
hanna+may21@wp-media.meClass "Container" not foundorClass "Imagify\Plugin" not founderrorsAffected Features & Quality Assurance Scope
Signup flow (JS email encoding), plugin bootstrap (Container import & autoloader), bulk optimization page (PHPStan fix for filter_input). No existing optimization features are affected.
Technical description
Documentation
The signup AJAX request URL-encodes the email with
encodeURIComponent()so that+characters are transmitted as%2Binstead of being decoded as spaces by PHP. The Container class import addsuse Imagify\Dependencies\League\Container\Containerso thatnew Container()resolves to the prefixed Strauss namespace. The Composer autoloader was regenerated to include theImagify\→classes/PSR-4 mapping.New dependencies
None.
Risks
Low. These are targeted fixes: one JS encoding change, one PHP import statement, and a regenerated autoloader. The FILTER_REQUIRE_ARRAY fix in Bulk.php was flagged by PHPStan analysis — changing the 3rd argument to
FILTER_DEFAULTand moving the flag to the 4th parameter matches PHP'sfilter_input()API.Mandatory Checklist
Code validation
Code style
Unticked items justification
The changed code (JS encoding, PHP import, autoloader regeneration, filter_input fix) is straightforward single-line or generated changes. Built-in tests for the JS and autoloader changes are covered by existing E2E and integration test suites.
Additional Checks