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

Header Already Sent #8

Open
huhufajri opened this issue Mar 5, 2018 · 1 comment
Open

Header Already Sent #8

huhufajri opened this issue Mar 5, 2018 · 1 comment

Comments

@huhufajri
Copy link

Hi there

i found some error when use your extensions in my new server. it told header already sent on ChatRoom.php file. I use Yii 2.0.14
.....
if ($message) {
$model->message = $message;
$model->userId = Yii::$app->user->id;

        if ($model->save()) {
            echo $model->data(); // this cause error
        } else {
            print_r($model->getErrors());
            exit(0);
        }
    } else {
        \echo $model->data(); //this cause error
    }

....

then i find solution in yiisoft/yii2#15782

I try replace following code like
...
if ($message) {
$model->message = $message;
$model->userId = Yii::$app->user->id;

        if ($model->save()) {
            \Yii::$app->response->data = $model->data(); // change
        } else {
            print_r($model->getErrors());
            exit(0);
        }
    } else {
        //echo $model->data();
        \Yii::$app->response->data = $model->data(); //change
    }

...

Thanks for your attentions.. Sorry for bad english :D

@sintret
Copy link
Owner

sintret commented Mar 13, 2018

Great, I will update the extension soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants