[PATCH] Spreadsheet_Excel_Writer have two problems with non ISO-8859-1 characters

From: Date: Thu, 17 Apr 2003 05:06:01 +0000
Subject: [PATCH] Spreadsheet_Excel_Writer have two problems with non ISO-8859-1 characters
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15209@lists.php.net to get a copy of this message
Hi. Recently, I saw tow problems of Spreadsheet_Excel_Writer in the Japanese PHP-users mailing list. - Apache dies with bus error. - PHP Warning message (REG_ERANGE) appears in Parser.php. The cause of problems seems to be attributable to non ISO-8859-1 characters. The following patch may be necessary to solve these problems. Regards, -- KUBO Atsuhiro e-mail: kubo@isite.co.jp Index: Writer/OLEwriter.php =================================================================== RCS file: /repository/pear/Spreadsheet_Excel_Writer/Writer/OLEwriter.php,v retrieving revision 1.6 diff -u -r1.6 OLEwriter.php --- Writer/OLEwriter.php 18 Mar 2003 00:17:36 -0000 1.6 +++ Writer/OLEwriter.php 17 Apr 2003 03:08:01 -0000 @@ -240,7 +240,7 @@ * * @param string $data string of bytes to be written */ - function write($data) //por ahora sÿÿo a STDOUT + function write($data) //por ahora s o a STDOUT { fwrite($this->_filehandle,$data,strlen($data)); } Index: Writer/Parser.php =================================================================== RCS file: /repository/pear/Spreadsheet_Excel_Writer/Writer/Parser.php,v retrieving revision 1.17 diff -u -r1.17 Parser.php --- Writer/Parser.php 10 Apr 2003 20:40:03 -0000 1.17 +++ Writer/Parser.php 17 Apr 2003 03:08:02 -0000 @@ -561,7 +561,7 @@ { return(pack("C", $this->ptg[$token])); } - elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token)) + elseif(preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token)) { return($this->_convertFunction($token,$this->_func_args)); } @@ -1097,7 +1097,7 @@ return($token); } // if it's a function call - elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "(")) + elseif(preg_match("/^[A-Z0-9\xc0-\xdc.]+$/i",$token) and ($this->_lookahead == "(")) { return($token); } @@ -1348,7 +1348,7 @@ return($result); } // if it's a function call - elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token)) + elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token)) { $result = $this->_func(); return($result); Index: Writer/OLEwriter.php =================================================================== RCS file: /repository/pear/Spreadsheet_Excel_Writer/Writer/OLEwriter.php,v retrieving revision 1.6 diff -u -r1.6 OLEwriter.php --- Writer/OLEwriter.php 18 Mar 2003 00:17:36 -0000 1.6 +++ Writer/OLEwriter.php 17 Apr 2003 03:08:01 -0000 @@ -240,7 +240,7 @@ * * @param string $data string of bytes to be written */ - function write($data) //por ahora sÿÿo a STDOUT + function write($data) //por ahora s o a STDOUT { fwrite($this->_filehandle,$data,strlen($data)); } Index: Writer/Parser.php =================================================================== RCS file: /repository/pear/Spreadsheet_Excel_Writer/Writer/Parser.php,v retrieving revision 1.17 diff -u -r1.17 Parser.php --- Writer/Parser.php 10 Apr 2003 20:40:03 -0000 1.17 +++ Writer/Parser.php 17 Apr 2003 03:08:02 -0000 @@ -561,7 +561,7 @@ { return(pack("C", $this->ptg[$token])); } - elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token)) + elseif(preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token)) { return($this->_convertFunction($token,$this->_func_args)); } @@ -1097,7 +1097,7 @@ return($token); } // if it's a function call - elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "(")) + elseif(preg_match("/^[A-Z0-9\xc0-\xdc.]+$/i",$token) and ($this->_lookahead == "(")) { return($token); } @@ -1348,7 +1348,7 @@ return($result); } // if it's a function call - elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token)) + elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token)) { $result = $this->_func(); return($result);

« previous php.pear.dev (#15209) next »