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

Disable PHP output buffering when reading file contents (fixes #389) #519

Closed
wants to merge 1 commit into from
Closed

Disable PHP output buffering when reading file contents (fixes #389) #519

wants to merge 1 commit into from

Conversation

smaarn
Copy link

@smaarn smaarn commented Oct 14, 2022

Basically I was facing the same issue as in #389 and there was always the option of playing with the PHP options but I wonder if the buffering shouldn't be disabled altogether in this kind of process.

So here the idea was to simply flush the output buffer and stop using it and then read the file contents.

Two notes:

  1. In terms of performance I'm not a guru enough to be able to assess whether buffering adds a lot of value here. But there may be cases where it has so this could be the wrong path
  2. When opening the file in read mode a "read lock" was put on the file before reading the file size. By reading the file contents brutally without opening the file handle there is a risk for having inconsistent data (if file is changed basically between the reading of the file size and the reading of its contents). But that seemed farfetched to me.

But I also may be missing something here :)

fetch.php Outdated Show resolved Hide resolved
@mikespub
Copy link

Replaced by equivalent #518
Included in #522 and release 1.2.2 at https://github.com/mikespub-org/seblucas-cops

@smaarn
Copy link
Author

smaarn commented Jul 14, 2023

Replaced by equivalent #518
Included in #522 and release 1.2.2 at https://github.com/mikespub-org/seblucas-cops

@mikespub thanks for the heads-up ! I will therefore be closing this MR and switch to the forked version.

@smaarn smaarn closed this Jul 14, 2023
@smaarn smaarn deleted the fix/disable-buffering-on-file-fetch branch July 14, 2023 15:25
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 this pull request may close these issues.

2 participants