mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fix: get rid of (some) PHP deprecation warnings
- CakeResponse.php strotime() and preg_split() warnings
This commit is contained in:
parent
be94fb8ea9
commit
a83e9c77bb
2 changed files with 10 additions and 2 deletions
|
@ -55,6 +55,10 @@ It means that composer will look at `master` branch of repository configured und
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 2024-01-19
|
||||||
|
|
||||||
|
- `strotime()` and `preg_split()` in CakeResponse deprecation warning fixes (passing null)
|
||||||
|
|
||||||
### 2024-01-11
|
### 2024-01-11
|
||||||
|
|
||||||
- `preg_replace` deprecation warning fixes (passing null instead of `string`)
|
- `preg_replace` deprecation warning fixes (passing null instead of `string`)
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ class CakeResponse {
|
||||||
$ifNoneMatchHeader = $request->header('If-None-Match');
|
$ifNoneMatchHeader = $request->header('If-None-Match');
|
||||||
$etags = array();
|
$etags = array();
|
||||||
if (is_string($ifNoneMatchHeader)) {
|
if (is_string($ifNoneMatchHeader)) {
|
||||||
$etags = preg_split('/\s*,\s*/', $ifNoneMatchHeader, null, PREG_SPLIT_NO_EMPTY);
|
$etags = preg_split('/\s*,\s*/', $ifNoneMatchHeader, 0, PREG_SPLIT_NO_EMPTY);
|
||||||
}
|
}
|
||||||
$modifiedSince = $request->header('If-Modified-Since');
|
$modifiedSince = $request->header('If-Modified-Since');
|
||||||
$checks = array();
|
$checks = array();
|
||||||
|
@ -1172,7 +1172,11 @@ class CakeResponse {
|
||||||
$checks[] = in_array('*', $etags) || in_array($responseTag, $etags);
|
$checks[] = in_array('*', $etags) || in_array($responseTag, $etags);
|
||||||
}
|
}
|
||||||
if ($modifiedSince) {
|
if ($modifiedSince) {
|
||||||
$checks[] = strtotime($this->modified()) === strtotime($modifiedSince);
|
if ($this->modified() === null) {
|
||||||
|
$checks[] = strtotime($modifiedSince) === false;
|
||||||
|
} else {
|
||||||
|
$checks[] = strtotime($this->modified()) === strtotime($modifiedSince);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (empty($checks)) {
|
if (empty($checks)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue