Skip to content

Stdlib: strcmp()/strncmp() null operands — empty-string coercion (#11261) - #11270

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-11261-strcmp-null-coerce
Jun 24, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-11261-strcmp-null-coerce

Conversation

@PurHur

@PurHur PurHur commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #11261

Verification

./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  php test/repro/maintainer_gap_strcmp_null_coerce.php
  php bin/vm.php test/repro/maintainer_gap_strcmp_null_coerce.php
  php bin/vm.php test/compliance/cases/stdlib/strcmp_null_coerce.phpt
  php bin/vm.php test/compliance/cases/stdlib/string_compare_null_scalar_typeerror.phpt
  php bin/compile.php -l test/repro/maintainer_gap_strcmp_null_coerce.php
'

Made with Cursor

Coerce null to empty string for string-compare builtins when the call
site is not strict_types (php-src ext/standard/string.c). Fix VmString
strncmp() empty-string padding to return -1/1 like Zend. JIT uses
JitStringBuiltinArg::lower() for Z_PARAM_STR coercion.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0b25379 into master Jun 24, 2026
@PurHur
PurHur deleted the agent/issue-11261-strcmp-null-coerce branch June 24, 2026 17:39
PurHur added a commit that referenced this pull request Jun 24, 2026
…per (#11271)

#11270 added vmStringArg() private methods; refresh construct-flag counts
and line anchors so bootstrap-inventory --check stays green on master.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Stdlib: strcmp()/strncmp() null operands — TypeError not empty-string coercion (ext/standard/string.c)

1 participant