Skip to content

Stdlib: coerce null to empty string for typed string builtins (#18483)#18488

Closed
PurHur wants to merge 1 commit into
masterfrom
agent/stdlib-string-null-coercion-18483
Closed

Stdlib: coerce null to empty string for typed string builtins (#18483)#18488
PurHur wants to merge 1 commit into
masterfrom
agent/stdlib-string-null-coercion-18483

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Restores Zend Z_PARAM_STR null→"" coercion for addslashes, stripslashes, htmlspecialchars, htmlentities, strip_tags, wordwrap, and addcslashes after the Stdlib: null operand coercion parity batch (#18369–#18378) #18385 regression reintroduced rejectNullString / coerceTypedStringBuiltinArg paths.
  • VM: route $string through InternalStrictArg::resolveCoercibleStringArg (respects caller strict_types).
  • JIT: switch from lowerTypedString / rejectNullString to lowerStrictOrCoercible.
  • php-src reference: ext/standard/string.c, ext/standard/html.c

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/string_builtin_null.php'
# htmlspecialchars: uncaught
# htmlentities: uncaught
# strtolower: uncaught
# addcslashes: uncaught
# trim: uncaught
# strip_tags: uncaught

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter string_builtin_null'
# OK (VM + JIT compliance)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter addslashes_scalar_coercion'
# VM OK; JIT/AOT pre-existing infra issues on this host

Closes #18483

Made with Cursor

Restore Zend Z_PARAM_STR null→"" semantics for addslashes, stripslashes,
htmlspecialchars, htmlentities, strip_tags, wordwrap, and addcslashes
after #18385 regression; route VM through resolveCoercibleStringArg and
JIT through lowerStrictOrCoercible.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur

PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner Author

Duplicate of merged #18486 — closing.

@PurHur PurHur closed this Jul 13, 2026
@PurHur PurHur deleted the agent/stdlib-string-null-coercion-18483 branch July 13, 2026 04:13
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.

Regression: typed string builtins null operand — TypeError not empty string (re-#18190, ext/standard/string.c)

1 participant