~/talk

Cookie Boundaries You Don’t Notice in PHP: Server vs Client Differences Faced in SSR

TalkinJapaneseat PHP Conference Japan 2024 · on Sunday, 2024-12-22· [php, web-platform]
name:ma@me
slides:none on file

Builds a book-search app that stores form inputs in cookies, first in PHP then ported to Next.js/Node, and encounters errors and behavior differences because server-side code lacks the browser DOM (ReferenceError: document is not defined) and SSR (getServerSideProps) reads cookie state that can differ from the client. Demonstrates the resulting flash when client-side rendering overwrites server-rendered input values and recommends either centralizing cookie handling on the server or fetching fresh values from an API; notes PHP’s superglobals had hidden these issues.

AI-written summary · about

  1. 0:00Cookie boundaries in PHP
  2. 1:03SSR basics
  3. 3:07Frontend terms and SSR setup
  4. 4:53First server-side cookie error
  5. 6:19Server-side JavaScript lacks document
  6. 7:23PHP cookie handling
  7. 9:52Server-side props in SSR
  8. 11:17CSR and flickering issue
  9. 13:03Cookie reference mismatch
  10. 14:49Solving SSR cookie management
  11. 16:12PHP superglobals
  12. 17:38SSR learning curve
  13. 18:41PHP limitations
  14. 19:43SSR flexibility
  15. 20:47SSR vs PHP
  16. 21:31Conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.