Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response content could not be send manually #13037

Closed
woody712 opened this issue Aug 24, 2017 · 2 comments
Closed

Response content could not be send manually #13037

woody712 opened this issue Aug 24, 2017 · 2 comments
Labels
duplicate Duplicate issue. The duplicate issue is referenced in the comments

Comments

@woody712
Copy link

when I use Micro Applications,
I don't want to send the response automatically,
so I get the values by method "$app->getReturnedValue()" and put them in "Response Content".
At the last, send them by manual.

    try {
        $app = new Micro($di);
        ...
        $app->handle();
    } catch (\Exception $e) {
        
    }
    $app->response->send();
// right
class PressureController
{
    public function test()
    {
        return ['hello world'];
    }
}
// wrong
class PressureController
{
    public function test()
    {
        return 'hello world';
    }
}

But I got a strange question, If I return an array in handler, everything is be OK, for strings, it will be send automatically and throw exception below:

// 
hello world<br />
<b>Fatal error</b>:  Uncaught Phalcon\Http\Response\Exception: Response was already sent in phalcon/http/response.zep:611
Stack trace:
#0 /data/web/open-leo/src/app/public/index.php(32): Phalcon\Http\Response-&gt;send()
#1 {main}
  thrown in <b>phalcon/http/response.zep</b> on line <b>611</b><br />

Details

  • Phalcon version: 3.2.0
  • PHP Version: 7.0.19-1
  • Operating System: debian 9
  • Installation type: Compiling from source
  • Server: Nginx
@sergeyklay
Copy link
Contributor

Refs: #12908

@sergeyklay sergeyklay added the duplicate Duplicate issue. The duplicate issue is referenced in the comments label Aug 24, 2017
@sergeyklay
Copy link
Contributor

Refactored in the #12378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate issue. The duplicate issue is referenced in the comments
Projects
None yet
Development

No branches or pull requests

2 participants