MDL-67029 bennu: php74 fixup for bennu lib 0.1-custom

This commit is contained in:
Eloy Lafuente (stronk7)
2019-11-20 11:46:13 +08:00
committed by Jake Dallimore
parent 3c1b6ed7bd
commit 7a68a37fda
2 changed files with 20 additions and 20 deletions
+11 -11
View File
@@ -737,7 +737,7 @@ class iCalendar_property_duration extends iCalendar_property {
}
// Value must be positive
return ($value{0} != '-');
return ($value[0] != '-');
}
}
@@ -761,11 +761,11 @@ class iCalendar_property_freebusy extends iCalendar_property {
}
$pos = strpos($value, '/'); // We know there's only one / in there
if($value{$pos - 1} != 'Z') {
if($value[$pos - 1] != 'Z') {
// Start time MUST be in UTC
return false;
}
if($value{$pos + 1} != 'P' && substr($value, -1) != 'Z') {
if($value[$pos + 1] != 'P' && substr($value, -1) != 'Z') {
// If the second part is not a period, it MUST be in UTC
return false;
}
@@ -1279,13 +1279,13 @@ class iCalendar_property_request_status extends iCalendar_property {
$escch = false;
for($i = 0; $i < $len; ++$i) {
if($value{$i} == ';' && !$escch) {
if($value[$i] == ';' && !$escch) {
// Token completed
$parts[] = substr($value, $from, $i - $from);
$from = $i + 1;
continue;
}
$escch = ($value{$i} == '\\');
$escch = ($value[$i] == '\\');
}
// Add one last token with the remaining text; if the value
// ended with a ';' it was illegal, so check that this token
@@ -1306,23 +1306,23 @@ class iCalendar_property_request_status extends iCalendar_property {
return false;
}
if($parts[0]{0} < '1' || $parts[0]{0} > '4') {
if($parts[0][0] < '1' || $parts[0][0] > '4') {
return false;
}
$len = strlen($parts[0]);
// Max 3 levels, and can't end with a period
if($len > 5 || $parts[0]{$len - 1} == '.') {
if($len > 5 || $parts[0][$len - 1] == '.') {
return false;
}
for($i = 1; $i < $len; ++$i) {
if(($i & 1) == 1 && $parts[0]{$i} != '.') {
if(($i & 1) == 1 && $parts[0][$i] != '.') {
// Even-indexed chars must be periods
return false;
}
else if(($i & 1) == 0 && ($parts[0]{$i} < '0' || $parts[0]{$i} > '9')) {
else if(($i & 1) == 0 && ($parts[0][$i] < '0' || $parts[0][$i] > '9')) {
// Odd-indexed chars must be numbers
return false;
}
@@ -1346,8 +1346,8 @@ class iCalendar_property_request_status extends iCalendar_property {
$parts[$i] .= '#'; // This guard token saves some conditionals in the loop
for($j = 0; $j < $len; ++$j) {
$thischar = $parts[$i]{$j};
$nextchar = $parts[$i]{$j + 1};
$thischar = $parts[$i][$j];
$nextchar = $parts[$i][$j + 1];
if($thischar == '\\') {
// Next char must now be one of ";,\nN"
if($nextchar != ';' && $nextchar != ',' && $nextchar != '\\' &&
+9 -9
View File
@@ -162,7 +162,7 @@ function rfc2445_is_valid_value($value, $type) {
}
for($i = 0; $i < $len; ++$i) {
$ch = $value{$i};
$ch = $value[$i];
if(!($ch >= 'a' && $ch <= 'z' || $ch >= 'A' && $ch <= 'Z' || $ch >= '0' && $ch <= '9' || $ch == '-' || $ch == '+')) {
if($ch == '=' && $len - $i <= 2) {
continue;
@@ -211,7 +211,7 @@ function rfc2445_is_valid_value($value, $type) {
return false;
}
return($value{8} == 'T' &&
return($value[8] == 'T' &&
rfc2445_is_valid_value(substr($value, 0, 8), RFC2445_TYPE_DATE) &&
rfc2445_is_valid_value(substr($value, 9), RFC2445_TYPE_TIME));
break;
@@ -228,12 +228,12 @@ function rfc2445_is_valid_value($value, $type) {
return false;
}
if($value{0} == '+' || $value{0} == '-') {
if($value[0] == '+' || $value[0] == '-') {
$value = substr($value, 1);
--$len; // Don't forget to update this!
}
if($value{0} != 'P') {
if($value[0] != 'P') {
return false;
}
@@ -242,7 +242,7 @@ function rfc2445_is_valid_value($value, $type) {
$allowed = 'WDT';
for($i = 1; $i < $len; ++$i) {
$ch = $value{$i};
$ch = $value[$i];
if($ch >= '0' && $ch <= '9') {
$num .= $ch;
continue;
@@ -309,7 +309,7 @@ function rfc2445_is_valid_value($value, $type) {
$int = false;
$len = strlen($value);
for($i = 0; $i < $len; ++$i) {
switch($value{$i}) {
switch($value[$i]) {
case '-': case '+':
// A sign can only be seen at position 0 and cannot be the only char
if($i != 0 || $len == 1) {
@@ -349,7 +349,7 @@ function rfc2445_is_valid_value($value, $type) {
return false;
}
if($value{0} == '+' || $value{0} == '-') {
if($value[0] == '+' || $value[0] == '-') {
if(strlen($value) == 1) {
return false;
}
@@ -384,7 +384,7 @@ function rfc2445_is_valid_value($value, $type) {
}
else if(rfc2445_is_valid_value($parts[1], RFC2445_TYPE_DURATION)) {
// The period MUST NOT be negative
return ($parts[1]{0} != '-');
return ($parts[1][0] != '-');
}
// It seems to be illegal
@@ -752,7 +752,7 @@ function rfc2445_is_valid_value($value, $type) {
return false;
}
if($value{0} != '+' && $value{0} != '-') {
if($value[0] != '+' && $value[0] != '-') {
return false;
}