-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Request #73088: str_check_encoding and str_scrub #2129
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
Conversation
…harset from static to PHPAPI
@@ -98,7 +98,7 @@ static char *get_default_charset(void) { | |||
|
|||
/* {{{ get_next_char | |||
*/ | |||
static inline unsigned int get_next_char( | |||
PHPAPI unsigned int get_next_char( |
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 is not a good symbol name to export.
@@ -373,7 +373,7 @@ static inline unsigned int get_next_char( | |||
/* {{{ entity_charset determine_charset | |||
* returns the charset identifier based on current locale or a hint. | |||
* defaults to UTF-8 */ | |||
static enum entity_charset determine_charset(char *charset_hint) | |||
PHPAPI enum entity_charset determine_charset(char *charset_hint) |
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.
Again, not a good name for export.
PHPAPI zend_string *php_escape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset); | ||
PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset, zend_bool double_encode); | ||
PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen, int all, int flags, char *hint_charset); | ||
PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, int *status); | ||
PHPAPI unsigned int get_next_char(enum entity_charset charset, const unsigned char *str, size_t str_len, size_t *cursor, int *status); | ||
PHPAPI enum entity_charset determine_charset(char *charset_hint); |
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.
Take your lead on naming from the prototypes above these.
/* {{{ proto bool str_check_encoding([string str[, string encoding]]) */ | ||
PHP_FUNCTION(str_check_encoding) | ||
{ | ||
zend_string *str, *enc = NULL; |
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 is strange indentation.
I'm -1 on this. Porting functions from ext/mbstring to ext/standard because some people don't have mbstring installed makes no sense to me. We can't just duplicate our entire extension functionality into ext/standard because that's always available. |
Since we cannot merge this patch in it's current form because it's not satisfactory quality, and it has merge conflicts, and the author seems to have abandoned working on it, I'm closing this PR. |
Both
str_check_encoding
andstr_scrub
have same feature asmb_check_encoding
andmb_scrub
:fallback functions can be implemented by
htmlspecialchars
andhtmlspecialchars_decode
since PHP 5.4.0.