Skip to content

Commit 73bae70

Browse files
committed
PHP 7.4 Incompatibility Fixes
Fix array and string offset access using curly braces (Deprecated since PHP 7.4) Fix array and string offset access using curly braces (Deprecated since PHP 7.4) PHP 7.4 incompatibility fix: Passing the glue and pieces parameters in reverse order to implode has been deprecated since PHP 7.4
1 parent 80ff0d2 commit 73bae70

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

lib/helper/UrlHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ function _encodeText($text)
630630

631631
for ($i = 0; $i < strlen($text); $i++)
632632
{
633-
$char = $text{$i};
633+
$char = $text[$i];
634634
$r = mt_rand(0, 100);
635635

636636
# roughly 10% raw, 45% hex, 45% dec

lib/i18n/sfDateFormat.class.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
229229
for ($i = 0, $max = count($tokens); $i < $max; $i++)
230230
{
231231
$pattern = $tokens[$i];
232-
if ($pattern[0] == "'" && $pattern{strlen($pattern) - 1} == "'")
232+
if ($pattern[0] == "'" && $pattern[(strlen($pattern) - 1)] == "'")
233233
{
234234
$tokens[$i] = str_replace('``````', '\'', preg_replace('/(^\')|(\'$)/', '', $pattern));
235235
}
@@ -397,30 +397,30 @@ protected function getTokens($pattern)
397397

398398
for ($i = 0, $max = strlen($pattern); $i < $max; $i++)
399399
{
400-
if ($char == null || $pattern{$i} == $char || $text)
400+
if ($char == null || $pattern[$i] == $char || $text)
401401
{
402-
$token .= $pattern{$i};
402+
$token .= $pattern[$i];
403403
}
404404
else
405405
{
406406
$tokens[] = str_replace("''", "'", $token);
407-
$token = $pattern{$i};
407+
$token = $pattern[$i];
408408
}
409409

410-
if ($pattern{$i} == "'" && $text == false)
410+
if ($pattern[$i] == "'" && $text == false)
411411
{
412412
$text = true;
413413
}
414-
else if ($text && $pattern{$i} == "'" && $char == "'")
414+
else if ($text && $pattern[$i] == "'" && $char == "'")
415415
{
416416
$text = true;
417417
}
418-
else if ($text && $char != "'" && $pattern{$i} == "'")
418+
else if ($text && $char != "'" && $pattern[$i] == "'")
419419
{
420420
$text = false;
421421
}
422422

423-
$char = $pattern{$i};
423+
$char = $pattern[$i];
424424

425425
}
426426
$tokens[] = $token;

lib/i18n/sfNumberFormat.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ protected function formatInteger($string)
193193
// now for the integer groupings
194194
for ($i = 0; $i < $len; $i++)
195195
{
196-
$char = $string{$len - $i - 1};
196+
$char = $string[($len - $i - 1)];
197197

198198
if ($multiGroup && $count == 0)
199199
{

lib/i18n/sfNumberFormatInfo.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ protected function parsePattern($pattern)
316316
// to find the groupsize 1.
317317
for ($i = strlen($pattern) - 1; $i >= 0; $i--)
318318
{
319-
if ($pattern{$i} == $digit || $pattern{$i} == $hash)
319+
if ($pattern[$i] == $digit || $pattern[$i] == $hash)
320320
{
321321
$groupSize1 = $i - $groupPos1;
322322
break;
@@ -335,11 +335,11 @@ protected function parsePattern($pattern)
335335
{
336336
for ($i = strlen($pattern) - 1; $i >= 0; $i--)
337337
{
338-
if ($pattern{$i} == $dot)
338+
if ($pattern[$i] == $dot)
339339
{
340340
break;
341341
}
342-
if ($pattern{$i} == $digit)
342+
if ($pattern[$i] == $digit)
343343
{
344344
$decimalPoints = $i - $decimalPos;
345345
break;

lib/view/sfViewCacheManager.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ protected function getCacheKeyVaryHeaderPart($internalUri, $vary = '')
236236
{
237237
$varys[] = $header . '-' . preg_replace('/\W+/', '_', $request->getHttpHeader($header));
238238
}
239-
$vary = implode($varys, '-');
239+
$vary = implode('-', $varys);
240240
}
241241

242242
return $vary;

0 commit comments

Comments
 (0)