Skip to content

Stdlib: sem_get() auto_release bool + int coerce (#19515) - #19523

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-19515-sem-get-auto-release
Jul 16, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-19515-sem-get-auto-release

Conversation

@PurHur

@PurHur PurHur commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

php-src reference

  • ext/sysvsem/sysvsem.c / sysvsem.stub.php — bool $auto_release = true

PHP implementation

  • ext/sysvsem/SemArgs.php — parseOptionalBoolCoerce()
  • ext/sysvsem/sem_get.php, VmSem.php
  • lib/Compiler.php — arith + hoisted scalar ConstFetch producer inclusion
  • lib/BuiltinParamNames.php, InternalArgInfo patch

Test plan

  • Issue repro (VM matches Zend):
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/sem.php <<'"'"'PHP'"'"'
<?php
$key = 0x19515;
$a = @sem_get($key, 1, 0666, 1);
echo "int_arg=", (is_object($a) ? get_class($a) : "fail"), "\n";
$b = @sem_get($key + 1, 1, 0666, true);
echo "bool_arg=", (is_object($b) ? get_class($b) : "fail"), "\n";
$rf = new ReflectionFunction("sem_get");
$p = $rf->getParameters();
echo $p[2]->getName(), " ", $p[3]->getName(), " ", (string)$p[3]->getType(), "\n";
PHP
php /tmp/sem.php; php bin/vm.php /tmp/sem.php'

Output (both): SysvSemaphore / SysvSemaphore / permissions auto_release bool

  • php -d memory_limit=1536M vendor/bin/phpunit --filter SysvSemBuiltinTest — OK (2 tests)

Closes #19515

Made with Cursor

Parse auto_release as Z_PARAM_BOOL (int/float coerce), pass bool to host under
strict_types, and wire Plus+$true call-arg producers so $key+1,…,true works.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit a2c98b1 into master Jul 16, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-19515-sem-get-auto-release branch July 16, 2026 11:16
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: sem_get() auto_release — rejects int coerce and bool (re-#3704, ext/sysvsem/sysvsem.c)

1 participant