diff --git a/library/Zend/Cache/Storage/Adapter/DbaOptions.php b/library/Zend/Cache/Storage/Adapter/DbaOptions.php index 588141d8764..c913e673f77 100644 --- a/library/Zend/Cache/Storage/Adapter/DbaOptions.php +++ b/library/Zend/Cache/Storage/Adapter/DbaOptions.php @@ -117,6 +117,12 @@ public function setHandler($handler) throw new Exception\ExtensionNotLoadedException("DBA-Handler '{$handler}' not supported"); } + if ($handler === 'inifile') { + throw new Exception\ExtensionNotLoadedException( + "DBA-Handler 'inifile' does not reliably support write operations" + ); + } + $this->triggerOptionEvent('handler', $handler); $this->handler = $handler; return $this; diff --git a/tests/ZendTest/Cache/Storage/Adapter/DbaInifileTest.php b/tests/ZendTest/Cache/Storage/Adapter/DbaInifileTest.php index 0298505e2b2..265e3de1677 100644 --- a/tests/ZendTest/Cache/Storage/Adapter/DbaInifileTest.php +++ b/tests/ZendTest/Cache/Storage/Adapter/DbaInifileTest.php @@ -9,11 +9,20 @@ namespace ZendTest\Cache\Storage\Adapter; +use PHPUnit_Framework_TestCase as TestCase; +use Zend\Cache\Storage\Adapter\Dba; /** * @group Zend_Cache */ -class DbaInifileTest extends AbstractDbaTest +class DbaInifileTest extends TestCase { - protected $handler = 'inifile'; + public function testSpecifyingInifileHandlerRaisesException() + { + $this->setExpectedException('Zend\Cache\Exception\ExtensionNotLoadedException', 'inifile'); + $cache = new Dba(array( + 'pathname' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('zfcache_dba_') . '.inifile', + 'handler' => 'inifile', + )); + } }