2 MDL-20876 - replaced deprecated split() with explode() or str_split() where appropriate
4 diff --git a/lib/excel/Parser.php b/lib/excel/Parser.php
5 index f91cf98..06b9e23 100644
6 --- a/lib/excel/Parser.php
7 +++ b/lib/excel/Parser.php
8 @@ -538,10 +538,10 @@ class Parser
10 // Split the range into 2 cell refs
11 if(preg_match("/^([A-I]?[A-Z])(\d+)\:([A-I]?[A-Z])(\d+)$/",$range)) {
12 - list($cell1, $cell2) = split(':', $range);
13 + list($cell1, $cell2) = explode(':', $range);
15 elseif(preg_match("/^([A-I]?[A-Z])(\d+)\.\.([A-I]?[A-Z])(\d+)$/",$range)) {
16 - list($cell1, $cell2) = split('\.\.', $range);
17 + list($cell1, $cell2) = explode('..', $range);
20 die("Unknown range separator");
21 @@ -993,4 +993,4 @@ class Parser
26 \ No newline at end of file
28 diff --git a/lib/excel/Worksheet.php b/lib/excel/Worksheet.php
29 index 1eb7682..d7c5cfc 100644
30 --- a/lib/excel/Worksheet.php
31 +++ b/lib/excel/Worksheet.php
32 @@ -909,7 +909,7 @@ class Worksheet extends BIFFwriter
35 // Convert base26 column string to number
36 - $chars = split('', $col);
37 + $chars = str_split($col);
41 @@ -1530,13 +1530,13 @@ class Worksheet extends BIFFwriter
42 // Determine if the link contains a sheet reference and change some of the
43 // parameters accordingly.
44 // Split the dir name and sheet name (if it exists)
45 - list($dir_long , $sheet) = split('/\#/', $url);
46 + list($dir_long , $sheet) = explode('/#/', $url);
47 $link_type = 0x01 | $absolute;
51 $sheet_len = pack("V", strlen($sheet) + 0x01);
52 - $sheet = join("\0", split('', $sheet));
53 + $sheet = join("\0", str_split($sheet));
57 @@ -1555,7 +1555,7 @@ class Worksheet extends BIFFwriter
58 $dir_short = preg_replace('/\.\.\\/', '', $dir_long) . "\0";
60 // Store the long dir name as a wchar string (non-null terminated)
61 - $dir_long = join("\0", split('', $dir_long));
62 + $dir_long = join("\0", str_split($dir_long));
63 $dir_long = $dir_long . "\0";
65 // Pack the lengths of the dir strings
66 @@ -1644,7 +1644,7 @@ class Worksheet extends BIFFwriter
69 $sheet_len = pack("V", length($sheet) + 0x01);
70 - $sheet = join("\0", split('', $sheet));
71 + $sheet = join("\0", str_split($sheet));
75 @@ -1665,7 +1665,7 @@ class Worksheet extends BIFFwriter
78 # Store the long dir name as a wchar string (non-null terminated)
79 - $dir_long = join("\0", split('', $dir_long));
80 + $dir_long = join("\0", str_split($dir_long));
81 $dir_long = $dir_long . "\0";
84 @@ -2832,4 +2832,4 @@ class Worksheet extends BIFFwriter
85 $this->_append($header.$data);
89 \ No newline at end of file
95 Description of WriteExcel modifications to remove functions deprecated as of php 5.3
98 ===================================================================
99 RCS file: /cvsroot/moodle/moodle/lib/excel/Parser.php,v
100 retrieving revision 1.1
101 diff -u -r1.1 Parser.php
102 --- Parser.php 26 Sep 2003 04:18:02 -0000 1.1
103 +++ Parser.php 18 Nov 2009 03:58:49 -0000
106 return(pack("C", $this->ptg[$token]));
108 - elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))
109 + elseif(preg_match("/[A-Z0-9ᅵ-ᅵ\.]+/",$token))
111 return($this->_convert_function($token,$this->_func_args));
113 @@ -723,21 +723,21 @@
116 // if it's a reference
117 - if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and
118 - !ereg("[0-9]",$this->_lookahead) and
119 + if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and
120 + !preg_match("/[0-9]/",$this->_lookahead) and
121 ($this->_lookahead != ':') and ($this->_lookahead != '.'))
125 // if it's a range (A1:A2)
126 - elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and
127 - !ereg("[0-9]",$this->_lookahead))
128 + elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and
129 + !preg_match("/[0-9]/",$this->_lookahead))
133 // if it's a range (A1..A2)
134 - elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and
135 - !ereg("[0-9]",$this->_lookahead))
136 + elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and
137 + !preg_match("/[0-9]/",$this->_lookahead))
144 // if it's a function call
145 - elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))
146 + elseif(preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$token) and ($this->_lookahead == "("))
150 @@ -857,15 +857,15 @@
153 // if it's a reference
154 - if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))
155 + if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
157 $result = $this->_create_tree($this->_current_token, '', '');
162 - elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or
163 - eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token))
164 + elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or
165 + preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
167 $result = $this->_current_token;
172 // if it's a function call
173 - elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))
174 + elseif (preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$this->_current_token))
176 $result = $this->_func();
179 ===================================================================
180 RCS file: /cvsroot/moodle/moodle/lib/excel/Worksheet.php,v
181 retrieving revision 1.1
182 diff -u -r1.1 Worksheet.php
183 --- Worksheet.php 26 Sep 2003 04:18:02 -0000 1.1
184 +++ Worksheet.php 18 Nov 2009 03:58:50 -0000
185 @@ -1264,10 +1264,10 @@
188 // Strip the '=' or '@' sign at the beginning of the formula string
189 - if (ereg("^=",$formula)) {
190 + if (preg_match("/^=/",$formula)) {
191 $formula = preg_replace("/(^=)/","",$formula);
193 - elseif(ereg("^@",$formula)) {
194 + elseif(preg_match("/^@/",$formula)) {
195 $formula = preg_replace("/(^@)/","",$formula);