fix: get rid of (some) PHP deprecation warnings (#66)

- CakeResponse.php strlen() no longer accepts null as a parameter

Co-authored-by: Jan Pešek <jan@sinch.cz>
This commit is contained in:
Jan Pešek 2024-02-03 10:26:26 +01:00 committed by GitHub
parent 32459b11b6
commit 9140745ef1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -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)

View file

@ -516,7 +516,7 @@ class CakeResponse {
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)));
}
}
}