note 65434 deleted from function.register-shutdown-function by cmb

From: Date: Sun, 24 Nov 2019 08:57:27 +0000
Subject: note 65434 deleted from function.register-shutdown-function by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213224@lists.php.net to get a copy of this message
Note Submitter: morphling at quick dot cz ---- There is a note "Shutdown function is called during the script shutdown so headers are always already sent.", but my php 5.1 seems to act differently. Example: <?php class Test { private $running; public function main() { $this->running = true; ob_start(); error_reporting(E_ALL); register_shutdown_function(array($this, "clean_exit")); echo "Hello"; // triggers E_ERROR $fatal->error(); $this->running = false; } public function clean_exit() { if ($this->running) { header("Location: error.php"); } } } $t = new Test(); $t->main(); ?> This example redirects you on error.php, this could be a simple way to handle E_ERROR.

« previous php.notes (#213224) next »