ZF-12449: OutputCache caches boolean result of buffering NOT a string

Description

As a result OutputCache puts in cache file boolean result of buffering.


public function end()
{
    $key = array_pop($this->keyStack);
    if ($key === null) {
        throw new Exception\RuntimeException('Output cache not started');
    }
    
    $output = ob_end_flush(); // boolean
    if ($output === false) {
        throw new Exception\RuntimeException('Output buffering not active');
    }

    return $this->getOptions()->getStorage()->setItem($key, $output);
}

Please use {color:green}ob_get_flush(){color} instead {color:red}ob_end_flush(){color}, which returns result of buffering as a string.

Comments

I can't actually find this code!

It is code from version 2: {{Zend\Cache\Pattern\OutputCache}}!

Look at: https://github.com/zendframework/zf2/…

Doh!

Thanks Frank :)

This is a ZF2 issue, which is addresses here: https://github.com/zendframework/zf2/pull/2877