Fix uninitialised variable warning.

This commit is contained in:
Andrew McMillan 2009-04-16 00:27:21 +12:00
parent 76e4a83b75
commit bedba4bc4f

View File

@ -1,4 +1,4 @@
<?php <?php
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
* *
@ -49,7 +49,7 @@
*/ */
/** /**
* Takes an UTF-8 string and returns an array of ints representing the * Takes an UTF-8 string and returns an array of ints representing the
* Unicode characters. Astral planes are supported ie. the ints in the * Unicode characters. Astral planes are supported ie. the ints in the
* output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates
* are not allowed. * are not allowed.
@ -157,7 +157,7 @@ function utf8ToUnicode(&$str)
} }
} else { } else {
/* ((0xC0 & (*in) != 0x80) && (mState != 0)) /* ((0xC0 & (*in) != 0x80) && (mState != 0))
* *
* Incomplete multi-octet sequence. * Incomplete multi-octet sequence.
*/ */
return false; return false;
@ -168,12 +168,12 @@ function utf8ToUnicode(&$str)
} }
/** /**
* Takes an array of ints representing the Unicode characters and returns * Takes an array of ints representing the Unicode characters and returns
* a UTF-8 string. Astral planes are supported ie. the ints in the * a UTF-8 string. Astral planes are supported ie. the ints in the
* input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates
* are not allowed. * are not allowed.
* *
* Returns false if the input array contains ints that represent * Returns false if the input array contains ints that represent
* surrogates or are outside the Unicode range. * surrogates or are outside the Unicode range.
*/ */
function unicodeToUtf8(&$arr) function unicodeToUtf8(&$arr)
@ -201,7 +201,7 @@ function unicodeToUtf8(&$arr)
$dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 12) & 0x3f));
$dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f));
$dest .= chr(0x80 | ($src & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f));
} else { } else {
// out of range // out of range
return false; return false;
} }
@ -215,7 +215,7 @@ function check_string($ics){
$error[] = $line; $error[] = $line;
} }
} }
if(is_array($error)){ if(isset($error) && is_array($error)){
foreach($error as $line){ foreach($error as $line){
dbg_error_log( "LOG check_string","error on lines % invalid character in string %s" , ($line +1),$ics_file[$line] ); dbg_error_log( "LOG check_string","error on lines % invalid character in string %s" , ($line +1),$ics_file[$line] );
return false; return false;