Category
php-in-php · stdlib · streams (#1492)
Problem
stream_notification_callback() stores the user notifier in a JIT/AOT LLVM global via lib/JIT/Builtin/StreamNotificationRuntime.php, while the VM builtin already lives in ext/standard/stream_notification_callback.php.
Stream wrappers invoke the callback from both VM and JIT paths; duplicated storage causes risk of VM-set callbacks not visible to JIT stream I/O (and vice versa).
php-src reference
Repro
<?php
stream_notification_callback(function ($ncode, $severity, $message, $code, $transferred, $max) {
echo "notify:$ncode\n";
});
$ctx = stream_context_create(['http' => ['timeout' => 1]]);
@file_get_contents('http://127.0.0.1:1/', false, $ctx);
echo "done\n";
./script/docker-exec.sh -- php bin/vm.php repro.php
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php repro.php'
Callback must fire identically on VM and JIT; today JIT may read a different global slot than VM PHP storage.
Scope (this repo)
| Layer |
Path |
| VM SSOT |
ext/standard/stream_notification_callback.php, stream context state |
| LLVM today |
lib/JIT/Builtin/StreamNotificationRuntime.php (__phpc_stream_notification_callback_set) |
| JIT streams |
lib/JIT/Builtin/StreamReadJit.php, StreamIoJit.php — call PHP getter |
Done when
Related
Category
php-in-php·stdlib· streams (#1492)Problem
stream_notification_callback()stores the user notifier in a JIT/AOT LLVM global vialib/JIT/Builtin/StreamNotificationRuntime.php, while the VM builtin already lives inext/standard/stream_notification_callback.php.Stream wrappers invoke the callback from both VM and JIT paths; duplicated storage causes risk of VM-set callbacks not visible to JIT stream I/O (and vice versa).
php-src reference
ext/standard/streams.c—PHP_FUNCTION(stream_notification_callback),php_stream_notificationhelpersmain/streams/streams.c— notification dispatchRepro
./script/docker-exec.sh -- php bin/vm.php repro.php ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php repro.php'Callback must fire identically on VM and JIT; today JIT may read a different global slot than VM PHP storage.
Scope (this repo)
ext/standard/stream_notification_callback.php, stream context statelib/JIT/Builtin/StreamNotificationRuntime.php(__phpc_stream_notification_callback_set)lib/JIT/Builtin/StreamReadJit.php,StreamIoJit.php— call PHP getterDone when
StreamNotificationRuntime.phpdeleted or link stub only.phptundertest/compliance/cases/stdlib/stream_notification_callback*.phptRelated