Week 035 — The User Profile Finally Gets Fixed
The user profile page had been in a "mostly working" state for months. That ended this week.
Week of July 14, 2025
Progress
The profile page got validation across all fields, address sections included. Testing immediately found two address bugs: address lines 2 and 3 weren't loading into the page, and the third address line was being saved to the second address column in the database. Both traced back to a single place: the DTO was mis-assigning the address line fields, which manifested as two separate-looking symptoms from the same root cause.
The avatar save broke during refactoring and took most of a day to debug. The cause: avatar_path (with underscore) in one place, avatar-path (with hyphen) in another. No error message, just no value. A naming mismatch in the wrong place is invisible until the behavior is strange enough to trace.
The save code on the user profile page was refactored from promise chains to async/await, with Grok helping with the conversion. The result was noticeably cleaner and easier to read.
Cleave.js was added for phone number and postal code masking. Email and phone number changes were locked down — those fields are read-only now. Changing them requires a verification flow that isn't built yet, and shipping an unverified change path would be a bug waiting to happen.
Also switched save button triggering from onchange to oninput, which fires on every keystroke rather than on focus loss. Better for touch devices where the soft keyboard appearing and disappearing makes onchange feel unresponsive.
The Hard Part
bindParam requires a mutable variable reference. bindValue doesn't. The distinction had been causing unnecessary logging noise in the repository layer — all calls to bindParam were using literals, which PHP can't mutate. Switched to bindValue throughout and the noise went away.
Next Week
Country code and postal code masking need consolidation — currently they're in separate JSON files with different structures, and the Canada/US situation (same phone prefix, different postal codes) creates awkward edge cases.
