User tests: Successful: Unsuccessful:
Pull Request for Issue #19784 .
@ggppdk provided a better check than the merged one in #19611
php_value output_buffering Off
via htaccessSetting is off also after that patch.
@sandewt @Quy @ggppdk please test this one here again. Thanks.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_admin Installation |
Explanation test
BACKEND: testing PATCH
1) php_value output_buffering Off
System Information > PHP Settings
Output Buffering: Off -> OK
System Information > PHP Information
Output Buffering: Off -> OK
2) php_value output_buffering On
System Information > PHP Settings
Output Buffering: Off -> NOK
System Information > PHP Information
Output Buffering: On -> OK
Note: code patch
'output_buffering' => (int) ini_get('output_buffering') !== 0,
When I change the code to: (see Note 2)
'output_buffering' => ini_get('output_buffering') !== 0,
I have tested successfully (in backend + installer)
2) php_value output_buffering On
System Information > PHP Settings
Output Buffering: On -> OK
System Information > PHP Information
Output Buffering: On -> OK
Note 2: Strange I could not repeat this latter successfully !?
That is what i explained above
[EDIT]
"not above" but in issue #19784
php_value output_buffering Off
is invalid !
php_value output_buffering ANY_TEXT
is invalid
and it results to output buffering being off
Please see PHP docs
php_flag
with php_value output_buffering On
you did not enable the output buffer
Please read here
#19784 (comment)
You can use the following to check the value of output_buffer
php_info()
or with
var_dump(ini_get('out_buffering'))
if you see a value 'On' or any text value that does not start with 1-9 then output buffering is disabled
Then, by testing the following you will see that you get "headers already sent error"
(aka output_buffering is disabled)
<?php
echo 'test';
header("Location: http://www.php.net");
exit;
I have tested succesfully
'without' and 'with' the PATCH by using a boolean value (number).
I guess this is what you mean.
0 for Off and 4096 for On.
php_value output_buffering 0
and
php_value output_buffering 4096
without patch:
'output_buffering' => (bool) ini_get('output_buffering')
with patch:
'output_buffering' => (int) ini_get('output_buffering') !== 0
(I did not yet look at your test instructions above.)
<?php
echo '<br>On is '; var_dump((bool) 'On');
echo '<br>Off is '; var_dump((bool) 'Off');
echo '<br>Test is '; var_dump((bool) 'Test');
exit;
will give
On is bool(true)
Off is bool(true)
Test is bool(true)
But if output_buffering
is set to the above TEXT values then in all above cases it will be disabled
aka old code is bogus
Note. The syntax for setting output_buffering is completely different when set in htaccess compared to when set in php.ini hence the confusions
Per php.ini, here are possible values. If using one of these values correctly, then the original PR should be fine...right?
; Possible Values:
; On = Enabled and buffer is unlimited. (Use with caution)
; Off = Disabled
; Integer = Enables the buffer and sets its maximum size in bytes.
Propably it is best to fix it for J3.8.6
because if it was wrong only for the case of misconfiguration text value "blabla" or "On" or "Off"
-- then it could wait
but current code:
is_numeric() thing
gives true when it is "0" aka when it is turned off
thus it is really wrong, reporting output_buffering as always ON,
but again this is nothing critical right it is just for information
Testing instructions
e.g. 4096 or 1 or -4096test should be detected as "Enabled"
to test if it is enabled create file
<?php
echo 'test';
header("Test: test");
exit;
if you see error message
Warning: Cannot modify header information - headers already sent by
.htaccess:
php_value output_buffering 4096 IS ENABLED
php_value output_buffering 0 IS not
php_value output_buffering On IS not
php_value output_buffering Test IS not
php_value output_buffering -4096Test IS ENABLED
php_flag output_buffering on IS ENABLED
php_flag output_buffering off IS not
php.ini (restart webserver if needed)
output_buffering=off IS not
output_buffering=on IS ENABLED
output_buffering=0 IS not
output_buffering=4096 IS ENABLED
I have tested this item
>Propably it is best to fix it for J3.8.6
See commnent with results.
Propably it is best to fix it for J3.8.6
@ggppdk please check before patch -> with patch
Results
BACKEND before patch -> with patch
php_value output_buffering 4096 IS ENABLED: On -> On
php_value output_buffering 0 IS not: On + warning -> Off + warning
php_value output_buffering On IS not: On + warning -> Off + warning
php_value output_buffering Test IS not: Off + warning -> Off + warning
php_value output_buffering -4096Test IS ENABLED: Off -> On
php_flag output_buffering on IS ENABLED: On -> On
php_flag output_buffering off IS not: On + warning -> Off + warning
warning: headers already sent by ...
INSTALLER before patch -> with patch
php_value output_buffering 4096 IS ENABLED: Aan -> Aan
php_value output_buffering 0 IS not: Uit -> Uit
php_value output_buffering On IS not: Aan -> Uit
php_value output_buffering Test IS not: Aan -> Uit
php_value output_buffering -4096Test IS ENABLED: Aan -> Aan
php_flag output_buffering on IS ENABLED: Aan -> Aan
php_flag output_buffering off IS not: Uit -> Uit
On = Aan = IS ENABLED
Off = Uit = IS not
i see you also run the script that creates the warning to really confirm output_buffering being disabled or enabled
Yes indeed. I used the script only for the backend.
Remarkably the results, before the patch are different for the backend and the installer.
(Afterwards I could also test in English for the installer.)
Why is -4096Test
a valid value/enabled?
Why is -4096Test a valid value/enabled?
It will enable output buffering,
so we need to catch such "bad" case too
please test it (using the script i provided above) and see if output_buffering gets enabled, if you get no header sent warning it means that output_buffering was enabled
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-12 11:06:49 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
I have tested this item? unsuccessfully on c804164
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19791.