-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove long-deprecated mbstring INI settings #12445
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
base: master
Are you sure you want to change the base?
Conversation
Sorry, just to give credit where credit is due... I am looking through the code from @Girgias again and it doesn't have as many problems as I first thought. 👍🏻 I do think this PR is a little bit better though. |
In my opinion, all of it should be removed in PHP 9.0. But first all
connected functions should be properly deprecated.
Removing it in 8.4 is not recommended. If someone is still using it, it
could prove to be a serious BC. Such removals should only be done in major
releases.
But otherwise I am in favor of nuking this whole feature.
…On Sun, Oct 15, 2023, 21:16 Alex Dowad ***@***.***> wrote:
Sorry, just to give credit where credit is due... I am looking through the
code from @Girgias <https://github.com/Girgias> again and it doesn't have
as many problems as I first thought. 👍🏻
I do think this PR is a little bit better though.
—
Reply to this email directly, view it on GitHub
<#12445 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSHGGB2ANLAF32NUDXLLS3X7QY73AVCNFSM6AAAAAA6BGGKVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGQ3TSNJVG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should also formally deprecate mb_http_input()
, mb_http_output()
, mb_internal_encoding ()
, and other functions which tweak the INI settings.
IIRC the reason we didn't remove them in 8.0, is that until 7.4 MBString and Iconv didn't actually use the global INI settings.
@@ -4,7 +4,6 @@ Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_s | |||
mbstring | |||
--FILE-- | |||
<?php | |||
ini_set('mbstring.internal_encoding', 'ISO-8859-15'); | |||
ini_set('mbstring.encoding_translation', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated: This could use the INI PHPT section to set the INI config
@@ -3,7 +3,6 @@ htmlentities() should not be influenced by mb_internal_encoding() | |||
--INI-- | |||
default_charset= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test can also be deleted.
bool internal_encoding_set; | ||
bool http_output_set; | ||
bool http_input_set; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the two other fields not removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because while http_input_set
was only written from the handler for writes to mbstring.http_input
, http_output_set
(for example) is also written by the function mb_http_output
. Same for internal_encoding_set
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, we probably should deprecate the functions that affect those fields.
Also, what's the point of |
I'd have to check the code to refresh my memory on everything which is affected by |
Right, from a quick glance at the docs it also seems to affect |
Guessing ("detecting") a text's encoding is an inexact science and potentially unsafe.
It should never have been a "feature".
|
I agree. By the way, |
Yes, either the |
@Girgias Thank you for your addition. I was worried about Anyway, using input_encoding and output_encoding is correct. |
Dear @Girgias, @derickr, @youkidearitai, @kamil-tekiela... all of your comments are very helpful. Do you think we want to keep |
I don't want to keep it. But just because I can't see any reasonable use
for it, doesn't mean there isn't one. It would be good to discuss in
internals.
…On Tue, Oct 17, 2023, 18:55 Alex Dowad ***@***.***> wrote:
Dear @Girgias <https://github.com/Girgias>, @derickr
<https://github.com/derickr>, @youkidearitai
<https://github.com/youkidearitai>, @kamil-tekiela
<https://github.com/kamil-tekiela>... all of your comments are very
helpful.
Do you think we want to keep mb_output_handler or not? (
https://www.php.net/manual/en/function.mb-output-handler.php)
—
Reply to this email directly, view it on GitHub
<#12445 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSHGGEY3LZG5OCDFF4FYOTX72Z6LAVCNFSM6AAAAAA6BGGKVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRWHAYTCNJXG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Let me ask @dseguy to see if this is actually used. |
Forgot to update the PR, but @dseguy looked into it and there are |
I fully agree, and would like to put a |
I created the milestone and added the PR to it. |
@Girgias very kindly opened a PR for the same issue a few years ago: #5334. Apparently, the INI settings
mbstring.http_input
,mbstring.http_output
, andmbstring.internal_encoding
were deprecated in PHP 5.6 but have never been completely removed yet. It seems that it is high time to remove them.I just reviewed the PR from @Girgias, and discovered that it makes some changes which are not needed and which will definitely cause BC breaks. This is the reason why the changes in #5334 are not OK:
The internal mbstring functionality which could previously be accessed by (for example) setting
mbstring.http_input
was not accessible solely in that way. Rather than usingmbstring.http_input
, you could also set the INI settinginput_encoding
, and it would do the same thing. Likewise formbstring.http_output
; the same functionality could also be activated using the functionmb_http_output
. Or formbstring.internal_encoding
, you could call the functionmb_internal_encoding
.Since none of these features (such as the function
mb_internal_encoding
) are deprecated, we cannot remove any of the internal mbstring code which helps to implement them. All we can remove is the code which directly handles reads/writes to the obsolete INI settings.Some thorough review would really be appreciated here. Also, I would like to ask what section of UPGRADING it would be best to note this removal in. Or do we normally put a note in UPGRADING when deprecated features are removed?
@nikic @Girgias @cmb69 @bukka @kamil-tekiela @youkidearitai