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]: Fix potential leak when exporting #817

Merged
merged 6 commits into from
Jan 27, 2025
Merged

[Bug]: Fix potential leak when exporting #817

merged 6 commits into from
Jan 27, 2025

Conversation

kingjia90
Copy link
Contributor

@kingjia90 kingjia90 commented Jan 27, 2025

@kingjia90 kingjia90 added the Bug label Jan 27, 2025
@kingjia90 kingjia90 added this to the 1.7.4 milestone Jan 27, 2025
@blankse
Copy link
Contributor

blankse commented Jan 27, 2025

@kingjia90 I think we should put the fclose() to a finally block (https://www.php.net/manual/en/language.exceptions.php#language.exceptions.finally). So it will also be closed if a other exception is thrown and we have it only once.

@kingjia90
Copy link
Contributor Author

@blankse thank you, had the same thought but i wasn't sure, does it get affected by the return in the catch block?

@blankse
Copy link
Contributor

blankse commented Jan 27, 2025

@kingjia90 See in the php docs:
One notable interaction is between the finally block and a return statement. If a return statement is encountered inside either the try or the catch blocks, the finally block will still be executed.

@kingjia90 kingjia90 self-assigned this Jan 27, 2025
@kingjia90 kingjia90 merged commit 3428520 into 1.7 Jan 27, 2025
8 checks passed
@kingjia90 kingjia90 deleted the fix-potential-leak branch January 27, 2025 13:14
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants