-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add mbstring to KPHP (Package I & II & III -- 26 new functions) #965
Draft
catnyan02
wants to merge
32
commits into
VKCOM:master
Choose a base branch
from
catnyan02:mbstring
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nd Windows-1251 encodings and add runtime declarations of all mbstring functions
add test workflow
add test workflow
…r, mb_strtoupper, mb_strwidth, mb_strpos, mb_stripos, mb_strripos, mb_strrpos, mb_stristr, mb_strrchr, mb_strrichr, mb_strstr) + php tests
# Conflicts: # builtin-functions/_functions.txt # cmake/external-libraries.cmake # cmake/init-compilation-flags.cmake # compiler/compiler-settings.cpp # runtime/interface.cpp # runtime/regexp.h # server/server-stats.cpp # tests/cpp/runtime/runtime-tests.cmake
catnyan02
changed the title
Add mbstring to KPHP (Package I -- 14 new functions)
Add mbstring to KPHP (Package I & II -- 21 new functions)
May 14, 2024
# Conflicts: # runtime/mbstring/mbstring.cpp
catnyan02
changed the title
Add mbstring to KPHP (Package I & II -- 21 new functions)
Add mbstring to KPHP (Package I & II & III -- 31 new functions)
Jul 23, 2024
catnyan02
changed the title
Add mbstring to KPHP (Package I & II & III -- 31 new functions)
Add mbstring to KPHP (Package I & II & III -- 26 new functions)
Jul 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is mbstring
While there are many languages in which every necessary character can be represented by a one-to-one mapping to an 8-bit value, there are also several languages which require so many characters for written communication that they cannot be contained within the range a mere byte can code (A byte is made up of eight bits. Each bit can contain only two distinct values, one or zero. Because of this, a byte can only represent 256 unique values (two to the power of eight)). Multibyte character encoding schemes were developed to express more than 256 characters in the regular bytewise coding system.
When you manipulate (trim, split, splice, etc.) strings encoded in a multibyte encoding, you need to use special functions since two or more consecutive bytes may represent a single character in such encoding schemes. Otherwise, if you apply a non-multibyte-aware string function to the string, it probably fails to detect the beginning or ending of the multibyte character and ends up with a corrupted garbage string that most likely loses its original meaning.
mbstring provides multibyte specific string functions that help you deal with multibyte encodings in PHP. In addition to that, mbstring handles character encoding conversion between the possible encoding pairs. mbstring is designed to handle Unicode-based encodings such as UTF-8 and UCS-2 and many single-byte encodings for convenience.
(source)
Installing
Similar to PHP, in KPHP mbstring is an extension, so to use mbstring in KPHP you need to specify cmake flag -DMBFL=On when building.
Runnings tests
ctest -j$(nproc) | grep mbstring
python3 kphp_tester.py mbstring
Finished