Skip to content

Stdlib: shm_attach()/shm_get_var()/shm_put_var()/shm_remove_var()/shm_detach() — ext/sysvshm (#6436)#18667

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-6436-sysvshm
Jul 13, 2026
Merged

Stdlib: shm_attach()/shm_get_var()/shm_put_var()/shm_remove_var()/shm_detach() — ext/sysvshm (#6436)#18667
PurHur merged 1 commit into
masterfrom
agent/issue-6436-sysvshm

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds new ext/sysvshm/ module with all five legacy System V shared-memory API functions.
  • PHP-in-PHP: VM SysvSharedMemory objects bridge to host SysvSharedMemory segments via VmSysvShm (no new C runtime logic).
  • php-src reference: ext/sysvshm/sysvshm.c

Closes #6436

Verification

Issue repro (Docker):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "echo function_exists(\"shm_attach\")?\"yes\":\"no\";"
php bin/vm.php -r "
\$shm_id = @shm_attach(0x6436, 1024, 0644);
shm_put_var(\$shm_id, 1, \"hello\");
echo shm_get_var(\$shm_id, 1), \"\n\";
shm_remove_var(\$shm_id, 1);
shm_detach(\$shm_id);
"'

Output:

yes
hello

Compliance + inventory:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit --filter SysvShmBuiltinTest
php script/bootstrap-inventory.php --check'

Output:

OK (1 test, 1 assertion)
OK 4792/4792

Made with Cursor

Register shm_attach/shm_get_var/shm_put_var/shm_remove_var/shm_detach
as PHP-in-PHP builtins wrapping Zend sysvshm, with VM SysvSharedMemory
objects bridged to host segments for php-src-strict round-trips.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 2d7e26a into master Jul 13, 2026
1 check failed
@PurHur PurHur deleted the agent/issue-6436-sysvshm branch July 13, 2026 18: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.

Stdlib: shm_attach()/shm_get_var()/shm_put_var()/shm_remove_var()/shm_detach() — ext/sysvshm legacy API (ext/sysvshm/sysvshm.c)

1 participant