Skip to content

Prefer String#b over force_encoding and avoid mutating strings#2659

Open
byroot wants to merge 1 commit into
phusion:stable-6.1from
byroot:fstr
Open

Prefer String#b over force_encoding and avoid mutating strings#2659
byroot wants to merge 1 commit into
phusion:stable-6.1from
byroot:fstr

Conversation

@byroot

@byroot byroot commented May 20, 2026

Copy link
Copy Markdown

I started recording deprecation warning in production in the hope to enable Ruby's --enable-frozen-string-literal, but ran into two string literal deprecation warnings coming from passenger, one of which is:

src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:90: warning: literal string will be frozen in the future

Since passenger requires Ruby 2.5, all these check for force_encoding are useless, we can assume the presence of String#b.

@byroot

byroot commented May 20, 2026

Copy link
Copy Markdown
Author

Sorry, I meant to open this against master. stable-6.1 has no minimum required version.

@byroot byroot closed this May 20, 2026
@CamJN CamJN reopened this May 20, 2026
@CamJN

CamJN commented May 20, 2026

Copy link
Copy Markdown
Member

Actually master isn't used, this is the branch to use. Have you signed the contributor agreement before?

@byroot

byroot commented May 20, 2026

Copy link
Copy Markdown
Author

Actually master isn't used, this is the branch to use.

Right, but then not sure my patch work, it's not based on the right branch. It also assume Ruby 1.9+, but it seems on 6-1-stable 1.8 is still supported?

Have you signed the contributor agreement before?

I just sent the mail with the PDF.

@CamJN

CamJN commented May 20, 2026

Copy link
Copy Markdown
Member

ruby 2.5 is definitely required for stable-6.1.

@byroot

byroot commented May 20, 2026

Copy link
Copy Markdown
Author

Alright, I'll clean the PR then!

I started recording deprecation warning in production in the hope
to enable Ruby's `--enable-frozen-string-literal`, but ran into two
string literal deprecation warnings coming from passenger, one of which
is:

```
src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:90: warning: literal string will be frozen in the future
```

Since passenger requires Ruby 2.5, all these check for `force_encoding`
are useless, we can assume the presence of `String#b`.
@byroot

byroot commented May 20, 2026

Copy link
Copy Markdown
Author

Should be good to go.

I also have a followup commit to make passenger compatible with --enable-frozen-string-literal but I assume you prefer to have it in a another PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants