|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-04-07 17:18 UTC] michael dot vorisek at email dot cz
[2020-04-07 18:47 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2020-04-07 18:47 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
Description: ------------ For some reasons headers are not outputted when script is terminated with set_exception_handler(). I was not able to isolate the issue, simple test below does not have it, but the complex example below is repeatable across multiple servers and PHP versions (7.2 - 7.4.4). Test script: --------------- # this works even without flush() header('Content-Type: application/json', true); echo json_encode('test'); // flush(); set_exception_handler(function (Throwable $t) {return true;}); throw new \Exception(); # but in this code flush() is required, otherwise "text/html; charset=UTF-8" is outputted even if this exact content-type (with charset) is not outputted in this project at at (it has to come from PHP) https://github.com/atk4/ui/pull/1051/commits/423251f13e515a0dadaed548abe17989cfbf0f33#diff-58980ac23a3a9a0b92abd9805eed1e78R227 CI results prior fixing with flush(): https://github.com/atk4/ui/runs/556304096?check_suite_focus=true#step:9:50 It can be easily reproduced locally when you clone https://github.com/mvorisek/atk4_ui/commit/46411692933745ef7b715c608363393afc803b85 and open URL ./demos/sticky2.php?__atk_reload=atk_admin_button . Issue can be reproduced with fast-cgi and internal php web server. Expected result: ---------------- Headers, ie. content-type in the example, are always sent even if the execution is immediatelly terminated. Actual result: -------------- Headers are not outputed.