mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fix: Relative time may not be cached if specified in CacheHelper duration
This commit is contained in:
parent
1409ea3dda
commit
3acfb1da49
3 changed files with 1 additions and 12 deletions
|
@ -1605,12 +1605,6 @@ class DispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testFullPageCachingDispatch($url) {
|
public function testFullPageCachingDispatch($url) {
|
||||||
// PHP 8.0+ has a bug in which the expiration date is not cached
|
|
||||||
// if the expiration date is specified as a relative time.
|
|
||||||
if (PHP_MAJOR_VERSION >= 8) {
|
|
||||||
$this->markTestIncomplete('If an expiration date is specified as a relative time, it cannot be cached.');
|
|
||||||
}
|
|
||||||
|
|
||||||
Configure::write('Cache.disable', false);
|
Configure::write('Cache.disable', false);
|
||||||
Configure::write('Cache.check', true);
|
Configure::write('Cache.check', true);
|
||||||
Configure::write('debug', 2);
|
Configure::write('debug', 2);
|
||||||
|
|
|
@ -139,11 +139,6 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testLayoutCacheParsingNoTagsInViewWithRelativeDuration() {
|
public function testLayoutCacheParsingNoTagsInViewWithRelativeDuration() {
|
||||||
// PHP 8.0+ has a bug in which the expiration date is not cached
|
|
||||||
// if the expiration date is specified as a relative time.
|
|
||||||
if (PHP_MAJOR_VERSION >= 8) {
|
|
||||||
$this->markTestIncomplete('If an expiration date is specified as a relative time, it cannot be cached.');
|
|
||||||
}
|
|
||||||
$this->Controller->cache_parsing();
|
$this->Controller->cache_parsing();
|
||||||
$this->Controller->request->addParams(array(
|
$this->Controller->request->addParams(array(
|
||||||
'controller' => 'cache_test',
|
'controller' => 'cache_test',
|
||||||
|
|
|
@ -149,7 +149,7 @@ class CacheHelper extends AppHelper {
|
||||||
$cacheTime = $cacheAction;
|
$cacheTime = $cacheAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cacheTime && $cacheTime > 0) {
|
if ($cacheTime && ($cacheTime > 0 || isset(date_parse($cacheTime)['relative']))) {
|
||||||
$cached = $this->_parseOutput($out);
|
$cached = $this->_parseOutput($out);
|
||||||
try {
|
try {
|
||||||
$this->_writeFile($cached, $cacheTime, $useCallbacks);
|
$this->_writeFile($cached, $cacheTime, $useCallbacks);
|
||||||
|
|
Loading…
Reference in a new issue