return true;
}
+ $error = null;
+
// Silence error reporting
- set_error_handler(function () {});
+ set_error_handler(function ($errno, $msg) use (&$error) {
+ $error = $msg;
+ });
if (!$this->handle = fopen($this->file, 'r')) {
if ($this->handle = fopen($this->file, 'x')) {
restore_error_handler();
if (!$this->handle) {
- $error = error_get_last();
- throw new IOException($error['message'], 0, null, $this->file);
+ throw new IOException($error, 0, null, $this->file);
}
// On Windows, even if PHP doc says the contrary, LOCK_NB works, see