title: Cake php redirect error [Can not modify header information]
body: <p>I'm new to CakePHP. I'm just testing how it works. I use other frameworks in PHP. Here in CakePHP 3.6 freshly installed. I'm following CakePHP's blog tutorial. My code is: </p>
  
  <pre><code> $article = $this-&gt;Articles-&gt;newEntity();
              if ($this-&gt;request-&gt;is('post')) {
                  // Prior to 3.4.0 $this-&gt;request-&gt;data() was used.
                  $article = $this-&gt;Articles-&gt;patchEntity($article, $this-&gt;request-&gt;getData());
                  if ($this-&gt;Articles-&gt;save($article)) {
                      $this-&gt;Flash-&gt;success(__('Your article has been saved.'));
                     return $this-&gt;redirect(['action' =&gt; 'index']);
                  }
                  else {
                      $this-&gt;Flash-&gt;error(__('Unable to add your article.'));
                  }
  
              }
              $this-&gt;set('article', $article);
  </code></pre>
  
  <p>The problem is while redirecting to another action. When I comment line  <code>return $this-&gt;redirect(['action' =&gt; 'index']);</code> it works else it throws following error.</p>
  
  <p><code>Warning (512): Unable to emit headers. Headers sent in file=C:\Users\Dipti\blog\vendor\cakephp\cakephp\src\Error\Debugger.php line=853 [CORE\src\Http\ResponseEmitter.php, line 48]
  Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Dipti\blog\vendor\cakephp\cakephp\src\Error\Debugger.php:853) [CORE\src\Http\ResponseEmitter.php, line 148]</code></p>