title: php die() running twice?
body: <p>How is it possible that the snippet below prints out "readablenot readable" ? afaik a die() should stop everything immediately?</p>
  
  <p>EDIT: posted the full function. This is a function from <code>Zend_Search_Lucene_Storage_File_Filesystem</code>. We're always getting "file not readable" errors. The file does seem to be readable but the snippet below prints out "readablenot readable"</p>
  
  <p>EDIT 2: sorry, made some mistakes in the info I posted; all correct now.</p>
  
  <pre><code>public function __construct($filename, $mode='r+b')
      {
          global $php_errormsg;
  
          if(strpos($mode, 'w') === false) {
              die('not readable');
          }
          else die('readable');
  
          if (strpos($mode, 'w') === false  &amp;&amp;  !is_readable($filename)) {
              // opening for reading non-readable file
              require_once 'Zend/Search/Lucene/Exception.php';
              throw new Zend_Search_Lucene_Exception('File \'' . $filename . '\' is not readable.');
          }
  
          $trackErrors = ini_get('track_errors');
          ini_set('track_errors', '1');
  
          $this-&gt;_fileHandle = @fopen($filename, $mode);
  
          if ($this-&gt;_fileHandle === false) {
              ini_set('track_errors', $trackErrors);
              require_once 'Zend/Search/Lucene/Exception.php';
              throw new Zend_Search_Lucene_Exception($php_errormsg);
          }
  
          ini_set('track_errors', $trackErrors);
      }
  </code></pre>