-
Notifications
You must be signed in to change notification settings - Fork 8k
iconv: deprecate iconv_set_encoding() and iconv_get_encoding() #19664
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: PHP-8.5
Are you sure you want to change the base?
Conversation
Seems like you need to regenerate the optimized files |
e978952
to
e810d51
Compare
The generated |
I'm sorry. There was wrong order of Attribute and PHPDoc and parser didn't get it correctly. Now it should be fine. |
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.
I don't see this discussed in the RFC - the strings set_
or get_
are not mentioned in the RFC page at all, and the only mention of deprecation is
Use of iconv./mbstring. php.ini parameters raise E_DEPRECATED for 5.6 and up.
Given that
- it is unclear if deprecating these functions was a part of the RFC that was voted on
- its been >10 years since the RFC without marking the deprecations
I'm not sure this should be included in 8.5 (or even at all without some discussion, but that is a question for later). I'm not vetoing this for 8.5 at the moment, because maybe I'm missing something in that RFC?
CC @edorian
Marking as "request changes" so this doesn't get merged without addressing
I agree with Daniel. Additionally, stating "deprecated since 5.6" in the error message strikes me as odd as the deprecation wasn't in these versions. Or I'm very much misunderstanding what's happening here. |
Without proper INI settings those functions are pointless, so it's safer to deprecate those functions and users would switch to global encoding, than suddenly changing the behaviour of those.
Formally it was, but it was never marked in the code properly. I have written mail to internals list to address this matter. |
The mailing list email is great, but this should be discussed and probably also needs a full RFC (maybe just an entry in the PHP 8.6 deprecations mass RFC)
to "this should not be merged for 8.5" |
What's the reason? Deprecations are being accepted in this phase. |
I disagree, this feature was slated for deprecation way back in PHP 5.6 and removal in PHP 7 (it says 6, but this is due to confusion of the name of the release), and didn't get removed in PHP 7 due to a technical TODO which wasn't done in time. See following discussion: https://externals.io/message/103087. Confirming the status of the deprecation are the manual entries for the iconv and mbstring INI settings clearly state the followings:
and
respectively. Moreover, multiple discussion clearly indicate that removing the INI settings, which as established are formally slated for deprecation, while keeping the functions is nonsensical. Because what would those functions do, nothing? Delaying the deprecations of these functions to a latter point serves absolutely no point from my point of view. Especially as we don't know if a version 8.6 will even exist. I am going to be harsh, but forcing an RFC for something that is a natural follow-up and arguably was just forgotten in the original RFC, and has been multiple time argued that it should be done, is a waste of everyone's time and makes PHP look like a joke to people not familiar with the project. |
ext/iconv/iconv.stub.php
Outdated
/** @refcount 1 */ | ||
function iconv(string $from_encoding, string $to_encoding, string $string): string|false {} | ||
|
||
#[\Deprecated(since: '5.6', message: 'use internal_encoding, input_encoding, and output_encoding INI settings instead')] |
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.
Just put 8.5 as this is usually what we do when formally deprecating something.
#[\Deprecated(since: '5.6', message: 'use internal_encoding, input_encoding, and output_encoding INI settings instead')] | |
#[\Deprecated(since: '8.5', message: 'use internal_encoding, input_encoding, and output_encoding INI settings instead')] |
@Girgias you raise some good points |
110a0d0
to
e1e75d6
Compare
e1e75d6
to
cb0a253
Compare
According to RFC https://wiki.php.net/rfc/default_encoding the functions
iconv_set_encoding()
andiconv_get_encoding()
should be deprecated long time ago.It's preparation for seamless merge of #12445 (currently there is no deprecation for functions changing encoding in iconv). The same must be done for mbstring extension.