The problem is in that first if. _fetch() calls zend_shm_cache_fetch() and zend_disk_cache_fetch respectively which will return false if the item is not found (http://files.zend.com/help/Zend-Server/…).
The If-Statement should be if ($tmp !== false).