On Thu, Jan 24, 2019 at 4:17 PM Legale Legage <legale.leg...@gmail.com> wrote:
> Haven't checked php_mbregex.c > > This one is defined in mbstring.h but not exists in mbstring.c: > php_mb_check_encoding_list() > Thanks, dropped in https://github.com/php/php-src/commit/24085b187a7505aacb5bd76372f1522226656dd3 . > These are not used anywhere within php-src dir: > php_mb_mbchar_bytes() > php_mb_safe_strrchr() > The _ex versions are used though, so it probably doesn't make much sense to drop these. > I think something wrong with php_mb_mbchar_bytes_ex() > As far as i understand the function returns the character length in > bytes based on the character encoding. At least for the UTF-16, > UTF-16BE,UTF-16LE encodings it returns 1 but should return 2 or 4. > I agree that this function looks really fishy. It correctly handles UTF-8 and fixed-width encodings, but for everything else it always returns a character width of 1, which doesn't make much sense. Nikita On Thu, Jan 24, 2019, 15:45 Nikita Popov <nikita....@gmail.com wrote: > > > > On Thu, Jan 24, 2019 at 12:21 PM Legale Legage <legale.leg...@gmail.com> > wrote: > >> > >> Hello. > >> > >> Looking through the source code of the mbstring.c file I found a lot > >> of unused internal functions. It seems that this is just a bunch of > >> old junk. > >> > >> Examples: > >> > >> MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const > >> mbfl_encoding *enc) > >> MBSTRING_API size_t php_mb_mbchar_bytes(const char *s) > >> MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, > >> size_t nbytes) > >> MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int > >> c, size_t nbytes, const mbfl_encoding *enc) > > > > > > How did you determine that these are unused? I'm seeing uses for all of > them in mbstring.c or php_mbregex.c > > > > Nikita >