note 92959 deleted from function.register-shutdown-function by crell

From: Date: Wed, 30 Mar 2022 22:05:38 +0000
Subject: note 92959 deleted from function.register-shutdown-function by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217809@lists.php.net to get a copy of this message
Note Submitter: Filip Dalge ---- The following function register_close_function should reproduce the former php behavior of closing the connection before executing the shutdown handler, based on the code posted by sts at mail dot xubion dot hu. It does not work on any machine. <?php function register_close_function($func) { register_close_function::$func = $func; register_shutdown_function(array("register_close_function", "close")); ob_start(); } class register_close_function { // just a container static $func; function close() { header("Connection: close"); $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); flush(); call_user_func(register_close_function::$func); } } ?>

« previous php.notes (#217809) next »