Bonjour,

j'utilise un cette librairie pour lire les données d'un fichier excel.
Sur mon serveur local (wamp). je n'ai aucun probleme.

par contre une fois que je passe ce script sur mon serveur de developpement (redhat entreprise),
j'ai une erreur qui dit que le fichier n'est pas accessible en lecture.
Apres debuggage, c'est cette portion de code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {
			echo substr($this->data, 0, 8);
    		$this->error = 1; 
    		return false; 
   		}
de la fonction de lecture qui retourne une erreur.
en effet quand j'affiche les deux valeurs sur mon serveur local, j'ai exactement les mêmes données pour la constante IDENTIFIER_OLE et les premiers bits lus dans la chaine récupérée dans le fichier.
or sur mon dev, il y a des caractères en plus.

Quelqu'un aurait une idée pour la cause du problème?

MErci d'avance.


Ci dessous le code de la fonction.:

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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
define('IDENTIFIER_OLE', pack("CCCCCCCC",0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1));
 
 function read($sFileName){
 
    	// check if file exist and is readable (Darko Miljanovic)
    	if(!is_readable($sFileName)) {
 
    		$this->error = 1;
    		return false;
    	}
 
    	$this->data = @file_get_contents($sFileName);
    	if (!$this->data) { 
 
    		$this->error = 1; 
    		return false; 
   		}
 
   		if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {
 
    		$this->error = 1; 
    		return false; 
   		}
        $this->numBigBlockDepotBlocks = GetInt4d($this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
        $this->sbdStartBlock = GetInt4d($this->data, SMALL_BLOCK_DEPOT_BLOCK_POS);
        $this->rootStartBlock = GetInt4d($this->data, ROOT_START_BLOCK_POS);
        $this->extensionBlock = GetInt4d($this->data, EXTENSION_BLOCK_POS);
        $this->numExtensionBlocks = GetInt4d($this->data, NUM_EXTENSION_BLOCK_POS);
 
 
 
        $bigBlockDepotBlocks = array();
        $pos = BIG_BLOCK_DEPOT_BLOCKS_POS;
 
	$bbdBlocks = $this->numBigBlockDepotBlocks;
 
            if ($this->numExtensionBlocks != 0) {
                $bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS)/4; 
            }
 
        for ($i = 0; $i < $bbdBlocks; $i++) {
              $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
              $pos += 4;
        }
 
 
        for ($j = 0; $j < $this->numExtensionBlocks; $j++) {
            $pos = ($this->extensionBlock + 1) * BIG_BLOCK_SIZE;
            $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, BIG_BLOCK_SIZE / 4 - 1);
 
            for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; $i++) {
                $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
                $pos += 4;
            }   
 
            $bbdBlocks += $blocksToRead;
            if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
                $this->extensionBlock = GetInt4d($this->data, $pos);
            }
        }
 
       // var_dump($bigBlockDepotBlocks);
 
        // readBigBlockDepot
        $pos = 0;
        $index = 0;
        $this->bigBlockChain = array();
 
        for ($i = 0; $i < $this->numBigBlockDepotBlocks; $i++) {
            $pos = ($bigBlockDepotBlocks[$i] + 1) * BIG_BLOCK_SIZE;
            //echo "pos = $pos";	
            for ($j = 0 ; $j < BIG_BLOCK_SIZE / 4; $j++) {
                $this->bigBlockChain[$index] = GetInt4d($this->data, $pos);
                $pos += 4 ;
                $index++;
            }
        }
 
	//var_dump($this->bigBlockChain);
        //echo '=====2';
        // readSmallBlockDepot();
        $pos = 0;
	    $index = 0;
	    $sbdBlock = $this->sbdStartBlock;
	    $this->smallBlockChain = array();
 
	    while ($sbdBlock != -2) {
 
	      $pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE;
 
	      for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) {
	        $this->smallBlockChain[$index] = GetInt4d($this->data, $pos);
	        $pos += 4;
	        $index++;
	      }
 
	      $sbdBlock = $this->bigBlockChain[$sbdBlock];
	    }
 
 
        // readData(rootStartBlock)
        $block = $this->rootStartBlock;
        $pos = 0;
        $this->entry = $this->__readData($block);
 
        /*
        while ($block != -2)  {
            $pos = ($block + 1) * BIG_BLOCK_SIZE;
            $this->entry = $this->entry.substr($this->data, $pos, BIG_BLOCK_SIZE);
            $block = $this->bigBlockChain[$block];
        }
        */
        //echo '==='.$this->entry."===";
        $this->__readPropertySets();
 
    }