Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<RarEntry::__toStringRarException::isUsingExceptions>
^RarLast updated: Mon, 26 Oct 2026

The RarException class

(PECL rar >= 2.0.0)

Introduction

This class serves two purposes: it is the type of the exceptions thrown by the RAR extension functions and methods and it allows, through static methods to query and define the error behaviour of the extension, i.e., whether exceptions are thrown or only warnings are emitted.

The following error codes are used:

  • -1 - error outside UnRAR library

  • 11 - insufficient memory

  • 12 - bad data

  • 13 - bad archive

  • 14 - unknown format

  • 15 - file open error

  • 16 - file create error

  • 17 - file close error

  • 18 - read error

  • 19 - write error

  • 20 - buffer too small

  • 21 - unknown RAR error

  • 22 - password required but not given

Class synopsis

final class RarException extends Exception {
/* Methods */
public static function isUsingExceptions(): bool
public static function setUsingExceptions(bool $using_exceptions): void
/* Inherited methods */
final public function Exception::getMessage(): string
final public function Exception::getPrevious(): ?Throwable
final public function Exception::getCode(): int
final public function Exception::getFile(): string
final public function Exception::getLine(): int
final public function Exception::getTrace(): array
final public function Exception::getTraceAsString(): string
public function Exception::__toString(): string
private function Exception::__clone(): void
}

Table of Contents


<RarEntry::__toStringRarException::isUsingExceptions>
^RarLast updated: Mon, 26 Oct 2026