Bonjour, voilà j'ai un petit problème avec des exceptions assez bizarre.

J'ai fais une classe doc_exception qui récupèrera certaines erreurs pour les ajouter à mon objet doc.
Il y a 2 types d'erreurs : 'warning' et 'error'.
'error' stoppera l'exécution de tout ce qui se trouve dans le premier try catch.

Le programme fonctionne de la manière suivante :
Je récupère un XML récupère des informations principales puis utilise (dépendant celle-ci) une classe.
Cette partie se trouve dans entouré d'un try catch qui va récupérer mon erreur.
A l'intérieur de chaque classes, j'ai placé plusieurs try catch.

Ils fonctionnent de la manière suivante :
Si une erreur est levé, un test est fait dans le catch , si c'est un 'error', l'erreur est à nouveau levé pour etre récupéré et renvoyé jusqu'au tout premier try catch.

Le problème que je rencontre me semble étrange (il fonctionne parfaitement en local, mais une fois sur le serveur, un problème apparait).

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
foreach($block_data_array as $block_data) {
try {
	if(empty($block_data['field_a'])){
		//$this->addDebug("ERROR : field_a Tag missing or empty.");
//EXCEPTION concerning the field_a Tag missing or empty.
		throw new doc_exception(330);
	}else{
		$internal_department_id = "";
		if(empty($block_data['field_b'])){
//EXCEPTION concerning the tag field_b not existing or empty.
			throw new doc_exception(3301);
		}else {
			$internal_department_id = $db->getOne("...");
			if(empty($internal_department_id)){
//EXCEPTION concerning the tag field_b not existing in the table departments.
				throw new doc_exception(3302,'field_b = '.$block_data["field_b"]);
			}
		}
		$storage_unit_number = $block_data['field_a'];
		$i=1;
		do{
			$this->addDebug("Test if an Storage_Type (tag field_c".$i.") is existing.");
			if(empty($block_data['field_c'.$i])){
				if($i==1){
//EXCEPTION concerning the tag field_c1 : if this one do not exist, The Block can't be handled.
					throw new doc_exception(331,$storage_unit_number);
				}else{
					$this->addDebug("There is no more field_c in this Block.");
					$i=4;
				}
			}else{
				$storage_unit_type = $block_data['field_c'.$i];
				$storage_unit_id = $db->getOne("...");
				if(empty($storage_unit_id)){
//EXCEPTION concerning the tag field_c($i) and the tag field_a => We skip the insertion of this part if the 
					throw new doc_exception(332);
				}
				$storage_quantity = "";
				$storage_quantity_unit_id = "";
				try{
					if(is_numeric($block_data['lhmg'.$i])){
						$storage_quantity = $block_data['lhmg'.$i];
					}else{
//EXCEPTION concerning the tag lhmg($i) if numeric or not
						throw new doc_exception(333,'lhmg'.$i);
					}
				}catch (doc_exception $e){
					$error_msg = $e->getMsgError();
					if($error_msg!=""){$this->addDebug($error_msg);debugText($error_msg);}
					if($e->getTypeError()){throw $e;}
				}
				try{
					if(!empty($block_data['field_d'.$i])){
						$storage_quantity_unit_id = $db->getOne("...");
						if(empty($storage_quantity_unit_id)){
//EXCEPTION concerning 
							throw new doc_exception(3331,'field_d'.$i.'= '.$block_data['field_d'.$i]);
						}
					}else{
						throw new doc_exception(333,'field_d'.$i);
					}
				}catch (doc_exception $e){
					$error_msg = $e->getMsgError();
					if($error_msg!=""){$this->addDebug($error_msg);debugText($error_msg);}
					if($e->getTypeError()){throw $e;}
				}
				//TEST IF ALREADY EXISTING IN THE ARRAY
				$test_exist = false;
				foreach ($this->storage_unit_mapping as $storage_mapping){
					if((($storage_mapping['internal_department_id'])==$internal_department_id)&&(($storage_mapping['storage_unit_id'])==$storage_unit_id)){
						$test_exist = true;
					}
				}
				if($test_exist){
					$this->addDebug("this is existing in the array already.");
//EXCEPTION concerning 
					throw new doc_exception(334);
				}
				$this->addDebug("INSERT : ('internal_department_id' => $internal_department_id, 'storage_unit_id' => $storage_unit_id, 'storage_quantity' => $storage_quantity, 'storage_quantity_unit_id' => $storage_quantity_unit_id)"); 
				$this->storage_unit_mapping[] = array(
								'internal_department_id' => $internal_department_id,
								'storage_unit_id' => $storage_unit_id,
								'storage_quantity' => $storage_quantity,
								'storage_quantity_unit_id' => $storage_quantity_unit_id
								);
				$i++;
			}
		}while ($i<4);
	}
}catch (doc_exception $e){
	$error_msg = $e->getMsgError();
	if($error_msg!=""){$this->addDebug($error_msg);debugText($error_msg);}
	if($e->getTypeError()){throw $e;}
}
}
Tout les try catch fonctionnent, sauf le tout dernier qui est censé arrêter le parcours du bloc en cours pour passer au suivant et ajoute une erreur de type warning ou arrete tout avec une erreur de type 'error'.

En local, c'est ce qu'il se passe, tout fonctionne parfaitement.
Mais sur le serveur où il est prévu de fonctionner. le dernier catch est seulement ignoré et est donc récupéré par le catch au niveau supèrieur, qui est le tout premier.

Je ne vois pas pourquoi il ne fonctionne pas :s