downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Zip> <RarException::isUsingExceptions
[edit] Last updated: Fri, 14 Jun 2013

view this page in

RarException::setUsingExceptions

(PECL rar >= 2.0.0)

RarException::setUsingExceptionsActive ou désactive les exceptions dans le gestionnaire d'erreurs

Description

public static void RarException::setUsingExceptions ( bool $using_exceptions )

Si et seulement si l'argument vaut TRUE, alors, au lieu d'émettre des alertes et de retourner des valeurs spéciales indiquant une erreur lors que la bibliothèque UnRAR rencontre une erreur, une exception de type RarException est émise.

Les exceptions seront également lancées pour les erreurs suivantes, qui surviennent en dehors de la bibliothèque (leurs codes erreurs seront -1) :

Liste de paramètres

using_exceptions

Doit valoir TRUE pour active l'émission d'exceptions, FALSE pour le désactiver (par défaut).

Exemples

Exemple #1 Exemple avec RarException::setUsingExceptions()

<?php
var_dump
(RarException::isUsingExceptions());
$arch RarArchive::open("does_not_exist.rar");
var_dump($arch);

RarException::setUsingExceptions(true);
var_dump(RarException::isUsingExceptions());
$arch RarArchive::open("does_not_exist.rar");
var_dump($arch); //non atteint
?>

L'exemple ci-dessus va afficher quelque chose de similaire à :

bool(false)

Warning: RarArchive::open(): Failed to open does_not_exist.rar: ERAR_EOPEN (file open error) in C:\php_rar\trunk\tests\test.php on line 3
bool(false)
bool(true)

Fatal error: Uncaught exception 'RarException' with message 'unRAR internal error: Failed to open does_not_exist.rar: ERAR_EOPEN (file open error)' in C:\php_rar\trunk\tests\test.php:8
Stack trace:
#0 C:\php_rar\trunk\tests\test.php(8): RarArchive::open('does_not_exist....')
#1 {main}
  thrown in C:\php_rar\trunk\tests\test.php on line 8

Voir aussi



add a note add a note User Contributed Notes RarException::setUsingExceptions - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites