I am using PHP and The exception has been thrown because Unexpected PHP error [Can not modify header information - Headers that are already sent (output starts at /tests/simpletest/reporter.php:43)] Seriousness [ E_WARNING] in [blah_code.php line 280] I call it One way to go around this is to output buffering. You can change it in PHP configuration (and possibly in .htaccess), or you can use it and its related work ( and then: or other related functions I believe PHP call simpletest for unit testing. My test works fine until I try and set a cookie
try {setcookie ($ name, $ cookie, $ cookie_expires); } Exception exception ($ E) {blah}
the simplest has already written the header information, so I get the following:
$ this-> gt; Have seen unclear explanations on catching with the expectException (new exception); But what documentation or examples do work, can someone provide an example of doing work or can I tell about the documentation? to be clear. This is not my code output but the simple test.
ob_get_clean () ,
Ob_end_flush () , etc.). For example:
ob_start (); // Your header here is your header / cookie manipulation here
ob_end_clean (); // Stop buffering and dump everything (do not echo). Ob_end_flush (); // Close buffering off and resume buffer ob_get_clean (); // Stop buffering and return everything as a string.
ob_flush () at the end of the file if you do not.
Comments
Post a Comment