Skip to content

Stdlib: encoding/binary builtins reject null via typed string guards (#18252) - #18257

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-18252-encoding-null-strict
Jul 12, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-18252-encoding-null-strict

Conversation

@PurHur

@PurHur PurHur commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #18252

php-src reference

  • ext/standard/string.c — php_bin2hex, php_quoted_printable_encode/decode
  • ext/standard/base64.c — php_base64_encode

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_encoding_binary_null.php'
bin2hex(): Argument #1 ($string) must be of type string, null given
base64_encode(): Argument #1 ($string) must be of type string, null given
quoted_printable_encode(): Argument #1 ($string) must be of type string, null given
quoted_printable_decode(): Argument #1 ($string) must be of type string, null given
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php test/repro/maintainer_gap_encoding_binary_null.php'

Same output (JIT agrees).

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter encoding_null'
OK (4 tests, 4 assertions)

Made with Cursor

…18252)

Switch bin2hex/base64_encode/quoted_printable_encode/decode VM and JIT
lowering to coerceTypedStringBuiltinArg / lowerTypedString so null operands
TypeError like Zend instead of coercing to empty string.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 839aa7c into master Jul 12, 2026
@PurHur
PurHur deleted the agent/runtime-php-18252-encoding-null-strict branch July 12, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant