Skip to content

refactor: remove deprecations in HTTP#10000

Open
paulbalandan wants to merge 1 commit intocodeigniter4:4.8from
paulbalandan:cleanup-http
Open

refactor: remove deprecations in HTTP#10000
paulbalandan wants to merge 1 commit intocodeigniter4:4.8from
paulbalandan:cleanup-http

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

@paulbalandan paulbalandan commented Feb 24, 2026

Description
Sending this early to get the #10000 slot. 😂

This is not yet complete, but initially there are quite breaking changes:

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan added refactor Pull requests that refactor code breaking change Pull requests that may break existing functionalities docs needed Pull requests needing documentation write-ups and/or revisions. 4.8 PRs that target the `4.8` branch. labels Feb 24, 2026
@paulbalandan paulbalandan marked this pull request as draft February 24, 2026 15:50
@michalsn
Copy link
Copy Markdown
Member

Sending this early to get the #10000 slot. 😂

Haha, love the dedication 😆

I'm a little concerned about removing URI::setSilent(). Given how commonly it's used, this might be more disruptive than expected.

@paulbalandan
Copy link
Copy Markdown
Member Author

I'm a little concerned about removing URI::setSilent(). Given how commonly it's used, this might be more disruptive than expected.

The deprecation was made in #7252 , mainly because it's not in PSR-7. Do you mean to "un-deprecate" it?

@michalsn
Copy link
Copy Markdown
Member

Well, the reason in the comment ("Method not in PSR-7") isn't very fortunate, because PSR-7 allows extra methods.

The real problem is immutability and hidden behavioral state.

Since setSilent() has existed for a long time and occasionally comes up on Slack, I would prefer postponing removal until v5 to avoid unnecessary complaints.

@paulbalandan
Copy link
Copy Markdown
Member Author

Okay, I'll retain it and add a hard deprecation notice on it. For the *Silent tests, are you fine with removing them though?

@michalsn
Copy link
Copy Markdown
Member

Yes, thank you!

@github-actions github-actions bot added the stale Pull requests with conflicts label Feb 27, 2026
@github-actions

This comment was marked as resolved.

@paulbalandan paulbalandan removed stale Pull requests with conflicts docs needed Pull requests needing documentation write-ups and/or revisions. labels Mar 28, 2026
@paulbalandan paulbalandan changed the title refactor: remove deprecations in HTTP [WIP] refactor: remove deprecations in HTTP Mar 28, 2026
@paulbalandan paulbalandan marked this pull request as ready for review March 28, 2026 20:00
Comment on lines +261 to +262
@trigger_error(sprintf('The %s method is deprecated and will be removed in CodeIgniter 5.0.', __METHOD__), E_USER_DEPRECATED);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one problem with this: we use this method in Pager::calculateCurrentPage(). In practice, that means normal pagination will now emit deprecation notices.

{
if (array_key_exists('baseURI', $options)) {
$this->baseURI = $this->baseURI->setURI($options['baseURI']);
$this->baseURI = new URI($options['baseURI']);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also problematic. In the constructor, we call $uri->useRawQueryString(), which prevents the use of parse_str(). This is important because parse_str() would modify query parameters - for example, converting http://example.com/?foo.bar=baz into foo_bar=baz.

- **HTTP:** Removed the following properties and methods deprecated:
- ``CodeIgniter\HTTP\Message::getHeaders()`` (deprecated since v4.0.5)
- ``CodeIgniter\HTTP\Message::getHeader()`` (deprecated since v4.0.5)
- ``CodeIgniter\HTTP\Request::setMethod()`` (deprecated since v4.0.5)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of inheritance, this doesn't seem entirely true, as setMethod() is still available in the OutgoingRequest class.

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

Labels

4.8 PRs that target the `4.8` branch. breaking change Pull requests that may break existing functionalities refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants