note 65434 added to function.register-shutdown-function

From: Date: Sun, 30 Apr 2006 22:14:07 +0000
Subject: note 65434 added to function.register-shutdown-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-110210@lists.php.net to get a copy of this message
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. ---- Server IP: 212.24.129.6 Probable Submitter: 194.212.214.65 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php Edit -- http://master.php.net/note/edit/65434 Del: integrated -- http://master.php.net/note/delete/65434/integrated Del: useless -- http://master.php.net/note/delete/65434/useless Del: bad code -- http://master.php.net/note/delete/65434/bad+code Del: spam -- http://master.php.net/note/delete/65434/spam Del: non-english -- http://master.php.net/note/delete/65434/non-english Del: in docs -- http://master.php.net/note/delete/65434/in+docs Del: other reasons-- http://master.php.net/note/delete/65434 Reject -- http://master.php.net/note/reject/65434 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110210) next »