We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How do I reset persisted data in memory without restarting my machine

I found that if I did something like this...

$this->persistent->acl = NULL;

... then I found I could cause an unrecoverable error.

The error then persists. I thought I might be able to break the persistence and recover by restarting apache but this didn't work.

The only way I knew besides possibly restarting my machine was to do the following:

$this->persistent->acl = new Phalcon\Acl\Adapter\Memory();
unset($this->persistent->acl);

This then opens a path to setup my Access Control List.

My question is without using code how can I reset persistent variables in phalcon bad examples aside?



125.6k
Accepted
answer

Without using code? You can't.

I believe the persistence is stored in $_SESSION by default, so visiting a page that calls session_destroy() might work.



47.5k

Thanks had a look and there it is.

Killed it using:

    $this->session->destroy();


47.5k

Also I have used:

    unset($this->persistent->acl);

but I think $this->session->destroy(); is the right way to do it.