Skip to content

[2.0.0]+ \Flash\Session getMessages() removes all messages #10734

Closed
@VCJeroen

Description

@VCJeroen

Using the getMessages() without the $remove parameter or with it set to true removes all flash messages, regardless of the $type parameter passed with it. To me it looks like a return of Issue 1575, more or less.

Here's some example code:

use Phalcon\Mvc\Controller;

class TestController extends Controller
{
    public function testAction()
    {
        $this->flash->error('test1');
        $this->flash->success('test2');

        var_dump($this->flash->getMessages('error', false));
        var_dump($this->flash->getMessages('success'));
        var_dump($this->flash->getMessages('error'));

        die;
    }
}

This returns:

array(1) { [0]=> string(5) "test1" }
array(1) { [0]=> string(5) "test2" }
array(0) { }

instead of the expected:

array(1) { [0]=> string(5) "test1" }
array(1) { [0]=> string(5) "test2" }
array(1) { [0]=> string(5) "test1" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions