-
Notifications
You must be signed in to change notification settings - Fork 735
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
ob_start chunk_size 0/1 behave differently than any other value <4096 #3815
Comments
That's right, 0 and 1 do have a special meaning... https://www.php.net/manual/en/function.ob-start.php
https://www.php.net/manual/en/outcontrol.buffer-size.php
...that should probably be called out directly in the docs instead of buried in another page. |
Let me rephrase:
|
Relevant code: |
See php/php-src#16161. |
Why is the default size of 16KB used when using chunk size of 1? 1 should behave just like chunk size of 2-4096 and allocate 4KB. What's the reason that the default buffer size is 16 KB? This seems extremely arbitrary. |
Oh, right; another glitch. I'm going to amend php/php-src#16161.
I think it's somewhat arbitrary regardless which value would be chosen. |
This looks like a good old off-by-one error. See <php/doc-en#3815 (comment)>.
It doesn't have to be though. Ideally the default size is equal to 1 memory page - which is 4k/8k depending on the system.
Not sure if PHP can detect the memory page size without performance penalty - if it can, I think that should be the default. |
This should be a feature request on the php-src repo and not on the doc repo. |
@kkmuffme, that doesn't really apply to ZendMM; see https://www.phpinternalsbook.com/php7/memory_management/zend_memory_manager.html#zendmm-internal-design for details. |
Description
https://3v4l.org/fHmH7
The following code:
Resulted in this output:
But I expected this output instead:
PHP Version
8.3.x
Operating System
No response
The text was updated successfully, but these errors were encountered: