-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix mb_strimwidth RC info #9254
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -761,7 +761,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input) | |
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_input is deprecated"); | ||
} | ||
|
||
if (!new_value || !ZSTR_VAL(new_value)) { | ||
if (!new_value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you change this deliberately? If so, the implementation of the function could be simplified; basically to an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it produced a compiler warning (as the check is redundant) but I didn't want to change anything else. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that check really redundant? What about an empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cmb69 Then it's still decayed to a pointer that points to a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to demonstrate: https://godbolt.org/z/6x9z7d8a9 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like adding a new regression test is in order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Doesn't look like it. It was added here: 379d9a1 But maybe it was just always wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just tried checking what the manual says about It doesn't document what is "supposed" to happen if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, might be best for now. After all, these deprecated INI settings were supposed to be removed long ago. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll merge this without that commit for now. |
||
const char *encoding = php_get_input_encoding(); | ||
MBSTRG(http_input_set) = 0; | ||
_php_mb_ini_mbstring_http_input_set(encoding, strlen(encoding)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,6 @@ function mb_strcut(string $string, int $start, ?int $length = null, ?string $enc | |
|
||
function mb_strwidth(string $string, ?string $encoding = null): int {} | ||
|
||
/** @refcount 1 */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this hint is used for some kind of optimizations by the JIT? Probably for cases where the returned string doesn't "escape" and can be immediately freed at the end of a block? I just looked through the entire list and the annotations look accurate for the other functions. There are some other cases where potentially we could just return the input string unmodified, which might help to reduce the number of dynamic allocations. If I ever do that I will remember to adjust the annotations here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do wonder why |
||
function mb_strimwidth(string $string, int $start, int $width, string $trim_marker = "", ?string $encoding = null): string {} | ||
|
||
/** | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.