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

TwigUtil::$storage grows indefinitely #859

Open
malarzm opened this issue Jul 10, 2020 · 0 comments
Open

TwigUtil::$storage grows indefinitely #859

malarzm opened this issue Jul 10, 2020 · 0 comments

Comments

@malarzm
Copy link

malarzm commented Jul 10, 2020

Today I was looking for memory leaks in our application's test suite and found out that the storage in https://github.com/Payum/Core/blob/43954de6415e1a29fa09d7ca7949b071741afbc6/Bridge/Twig/TwigUtil.php#L9 keeps growing and is never cleared. This is not a big deal in a casual request-response lifecycle but is a big pain in a functional test suite. So far our solution is clearing the storage with our own class

<?php

declare(strict_types=1);

namespace App\Tests\Payum;

class TwigUtil extends \Payum\Core\Bridge\Twig\TwigUtil
{
    public static function clearStorage(): void
    {
        if (null === static::$storage) {
            return;
        }

        static::$storage->removeAll(static::$storage);
    }
}

which we call in tests' tearDown method however it'd be great to get rid of the memory leak at its source.

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