note 85727 added to function.register-shutdown-function

From: Date: Sun, 14 Sep 2008 21:26:28 +0000
Subject: note 85727 added to function.register-shutdown-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-144414@lists.php.net to get a copy of this message
Contrary to the the note that "headers are always sent" and some of the comments below - You CAN use header() inside of a shutdown function as you would anywhere else; when headers_sent() is false. You can do custom fatal handling this way: <?php ini_set('display_errors',0); register_shutdown_function('shutdown'); $obj = new stdClass(); $obj->method(); function shutdown() { if(!is_null($e = error_get_last())) { header('content-type: text/plain'); print "this is not html:\n\n". print_r($e,true); } } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 69.126.166.212 ---- Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php Edit -- https://master.php.net/note/edit/85727 Del: integrated -- https://master.php.net/note/delete/85727/integrated Del: useless -- https://master.php.net/note/delete/85727/useless Del: bad code -- https://master.php.net/note/delete/85727/bad+code Del: spam -- https://master.php.net/note/delete/85727/spam Del: non-english -- https://master.php.net/note/delete/85727/non-english Del: in docs -- https://master.php.net/note/delete/85727/in+docs Del: other reasons-- https://master.php.net/note/delete/85727 Reject -- https://master.php.net/note/reject/85727 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144414) next »