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

The getCurrentMessages method's logic #1

Open
weierophinney opened this issue Dec 31, 2019 · 0 comments
Open

The getCurrentMessages method's logic #1

weierophinney opened this issue Dec 31, 2019 · 0 comments

Comments

@weierophinney
Copy link
Member

Hi.

I understand the difference between the getMessages and getCurrentMessages methods and how they work, but I don't get why these "current" messages could be accessed on the second request even if we haven't really added anything during it.
Is this the expected behaviour? If so, what makes them "current" then?

Here's a test:

public function testCurrentMessages()
{
    $helper = new FlashMessenger();

    $this->assertFalse($helper->hasCurrentMessages()); // OK

    $helper->addMessage('foo');

    $this->assertTrue($helper->hasCurrentMessages()); // OK
    $this->assertFalse($helper->hasMessages()); // OK

    unset($helper);

    $helper2 = new FlashMessenger();

    $this->assertFalse($helper2->hasCurrentMessages()); // Failure
    $this->assertTrue($helper2->hasMessages()); // OK
}

Originally posted by @panychek at zendframework/zend-mvc-plugin-flashmessenger#25

remicollet added a commit to remicollet/laminas-mvc-plugin-flashmessenger that referenced this issue Mar 25, 2021
TypeError: method_exists(): Argument laminas#1 ($object_or_class) must be of type object|string, null given
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

1 participant