Skip to content

Stdlib: web_int/web_string/web_bool param coercion (issue #157)#387

Merged
PurHur merged 1 commit into
masterfrom
feat/web-param-coerce-157
May 20, 2026
Merged

Stdlib: web_int/web_string/web_bool param coercion (issue #157)#387
PurHur merged 1 commit into
masterfrom
feat/web-param-coerce-157

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 20, 2026

Summary

  • Adds web_int(), web_string(), and web_bool() builtins for safe query/body coercion (closes Web: Query/body param coercion helpers (int, bool, string) #157).
  • web_int and web_string register in ext/standard/Module.php with VM handlers and JIT lowering (JitWebParams) so they work from bin/compile.php / AOT binaries with $_GET refresh.
  • web_bool is VM-only for now (documented in docs/capabilities.md); AOT callers can use web_int($src, $key, 0) until bool-return JIT assignment is fixed.

Behavior

  • Invalid/missing keys return defaults without notices.
  • web_int supports optional min/max clamping.
  • web_string trims and optional maxLen truncation.

Test plan

  • VM: test/real/cases/web_param_coerce.phpt
  • JIT: test/compliance/cases/stdlib/web_param_coerce_jit.phpt
  • AOT: test/fixtures/aot/cases/web_param_coerce.phpt
  • Docker manual smoke: web_int/web_string AOT with QUERY_STRING
  • script/docker-ci-local.sh (88/91 AOT tests; 3 pre-existing getenv/putenv fixture failures unrelated to this change)

Made with Cursor

Ship query/body coercion helpers for compiled web apps: web_int and
web_string are reachable from compile.php with JIT/AOT lowering;
web_bool is VM-only until bool-return JIT assignment is fixed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur force-pushed the feat/web-param-coerce-157 branch from 22f8ed2 to fab0798 Compare May 20, 2026 17:11
@PurHur PurHur merged commit dc34373 into master May 20, 2026
1 check passed
@PurHur PurHur deleted the feat/web-param-coerce-157 branch May 20, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: Query/body param coercion helpers (int, bool, string)

1 participant