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

[BUG] Flash\Session::getMessage('key') returns ALL messages #908

Closed
quasipickle opened this issue Jul 24, 2013 · 3 comments
Closed

[BUG] Flash\Session::getMessage('key') returns ALL messages #908

quasipickle opened this issue Jul 24, 2013 · 3 comments

Comments

@quasipickle
Copy link
Contributor

I'm calling this a bug, but really it's just undocumented behaviour that I think should be changed.

Anyway, \Phalcon\Flash\Session::getMessage() returns an array of all flashed messages, when no messages of a requested type exist.

For example:

$this->flash->error('test');
$this->flash->warning('test2');
print_r($this->flash('success'));

Will output:

Array
(
    [error] => Array
        (
            [0] => test
        )

    [warning] => Array
        (
            [0] => test2
        )
)

To me this is counter-intuitive. If there are no "success" messages, I would expect getMessages('success') to return NULL or FALSE or at least an empty array. Otherwise there is no way to test if success/warning/etc messages exist.

@phalcon
Copy link
Collaborator

phalcon commented Jul 25, 2013

Fixed by @sjinks in #920, thanks

@kisb2
Copy link

kisb2 commented May 26, 2016

with newest version, this error still exists.... (Windows)

@sergeyklay
Copy link
Contributor

Create separated issue with scrupt to reproduce and Phalcon version

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

3 participants