Skip to content

Commit

Permalink
fix: get rid of (some) PHP deprecation warnings (#66)
Browse files Browse the repository at this point in the history
- CakeResponse.php strlen() no longer accepts null as a parameter

Co-authored-by: Jan Pešek <[email protected]>
  • Loading branch information
pesek and Jan Pešek authored Feb 3, 2024
1 parent 32459b1 commit 9140745
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ It means that composer will look at `master` branch of repository configured und

## Changelog

### 2024-02-02

- `str_len` deprecation warning fix in CakeResponse (passing null instead of `string`)

### 2024-01-19

- `strotime()` and `preg_split()` in CakeResponse deprecation warning fixes (passing null)
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/CakeResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ protected function _setContentLength() {
if (ini_get('mbstring.func_overload') & 2 && function_exists('mb_strlen')) {
$this->length($offset + mb_strlen($this->_body, '8bit'));
} else {
$this->length($this->_headers['Content-Length'] = $offset + strlen($this->_body));
$this->length($this->_headers['Content-Length'] = $offset + ($this->_body === null ? 0 : strlen($this->_body)));
}
}
}
Expand Down

0 comments on commit 9140745

Please sign in to comment.