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

Temporary memory clogging #35

Closed
daverdalas opened this issue Dec 1, 2023 · 1 comment · Fixed by #37
Closed

Temporary memory clogging #35

daverdalas opened this issue Dec 1, 2023 · 1 comment · Fixed by #37

Comments

@daverdalas
Copy link

At the beginning, many thanks for creating this package. I found it very useful. However, using it I noticed after a while that I ran out of memory on the server when using this package. It turned out that the files created with this package were never deleted. I dealt with this by extending the UploadedBase64EncodedFile class like this:

<?php

declare(strict_types=1);

namespace AppProject;

use Hshn\Base64EncodedFile\HttpFoundation\File as BaseUploadedBase64EncodedFile;

class UploadedBase64EncodedFile extends BaseUploadedBase64EncodedFile
{
    public function __destruct()
    {
        if (file_exists($this->getPathname())) {
            unlink($this->getPathname());
        }
    }
}

I can throw add this as a pull request or it might be worth mentioning in the readme that after using the class you should remember to remove the file from temporary memory so as not to clog up the server memory :)

@hshn
Copy link
Owner

hshn commented Dec 24, 2023

Thank you for reporting and the solution! I tried bringing that into #37. I hope the PR will solve the issue. It will be released soon.

@hshn hshn closed this as completed in #37 Dec 24, 2023
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

Successfully merging a pull request may close this issue.

2 participants