Skip to content

Commit b5c96fb

Browse files
authored
Merge pull request #23 from nutama/php7.4
php 7.4 compatibility
2 parents dda5ae7 + 79e36ce commit b5c96fb

File tree

27 files changed

+81
-86
lines changed

27 files changed

+81
-86
lines changed

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
language: php
22
php:
3+
- 7.4
34
- 7.3
4-
- 7.2
5-
- 7.1
6-
- 7.0
7-
- 5.6
85

96
before_script:
107
- composer install --dev

lib/cache/sfFileCache.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ protected function read($path, $type = self::READ_DATA)
215215
@flock($fp, LOCK_SH);
216216
clearstatcache(); // because the filesize can be cached by PHP itself...
217217
$length = @filesize($path);
218-
$mqr = get_magic_quotes_runtime();
219-
set_magic_quotes_runtime(0);
218+
220219
switch ($type)
221220
{
222221
case self::READ_TIMEOUT:
@@ -240,7 +239,6 @@ protected function read($path, $type = self::READ_DATA)
240239
default:
241240
throw new sfConfigurationException(sprintf('Unknown type "%s".', $type));
242241
}
243-
set_magic_quotes_runtime($mqr);
244242
@flock($fp, LOCK_UN);
245243
@fclose($fp);
246244

lib/helper/UrlHelper.php

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

472472
for ($i = 0; $i < strlen($text); $i++)
473473
{
474-
$char = $text{$i};
474+
$char = $text[$i];
475475
$r = rand(0, 100);
476476

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

lib/i18n/sfDateFormat.class.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
221221
for ($i = 0, $max = count($tokens); $i < $max; $i++)
222222
{
223223
$pattern = $tokens[$i];
224-
if ($pattern{0} == "'" && $pattern{strlen($pattern) - 1} == "'")
224+
if ($pattern[0] == "'" && $pattern[strlen($pattern) - 1] == "'")
225225
{
226226
$tokens[$i] = str_replace('``````', '\'', preg_replace('/(^\')|(\'$)/', '', $pattern));
227227
}
@@ -258,9 +258,9 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
258258
*/
259259
protected function getFunctionName($token)
260260
{
261-
if (isset($this->tokens[$token{0}]))
261+
if (isset($this->tokens[$token[0]]))
262262
{
263-
return $this->tokens[$token{0}];
263+
return $this->tokens[$token[0]];
264264
}
265265
}
266266

@@ -389,30 +389,30 @@ protected function getTokens($pattern)
389389

390390
for ($i = 0, $max = strlen($pattern); $i < $max; $i++)
391391
{
392-
if ($char == null || $pattern{$i} == $char || $text)
392+
if ($char == null || $pattern[$i] == $char || $text)
393393
{
394-
$token .= $pattern{$i};
394+
$token .= $pattern[$i];
395395
}
396396
else
397397
{
398398
$tokens[] = str_replace("''", "'", $token);
399-
$token = $pattern{$i};
399+
$token = $pattern[$i];
400400
}
401401

402-
if ($pattern{$i} == "'" && $text == false)
402+
if ($pattern[$i] == "'" && $text == false)
403403
{
404404
$text = true;
405405
}
406-
else if ($text && $pattern{$i} == "'" && $char == "'")
406+
else if ($text && $pattern[$i] == "'" && $char == "'")
407407
{
408408
$text = true;
409409
}
410-
else if ($text && $char != "'" && $pattern{$i} == "'")
410+
else if ($text && $char != "'" && $pattern[$i] == "'")
411411
{
412412
$text = false;
413413
}
414414

415-
$char = $pattern{$i};
415+
$char = $pattern[$i];
416416

417417
}
418418
$tokens[] = $token;

lib/i18n/sfNumberFormat.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ protected function formatInteger($string)
204204
// now for the integer groupings
205205
for ($i = 0; $i < $len; $i++)
206206
{
207-
$char = $string{$len - $i - 1};
207+
$char = $string[$len - $i - 1];
208208

209209
if ($multiGroup && $count == 0)
210210
{

lib/i18n/sfNumberFormatInfo.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ protected function parsePattern($pattern)
311311
// to find the groupsize 1.
312312
for ($i = strlen($pattern) - 1; $i >= 0; $i--)
313313
{
314-
if ($pattern{$i} == $digit || $pattern{$i} == $hash)
314+
if ($pattern[$i] == $digit || $pattern[$i] == $hash)
315315
{
316316
$groupSize1 = $i - $groupPos1;
317317
break;
@@ -330,11 +330,11 @@ protected function parsePattern($pattern)
330330
{
331331
for ($i = strlen($pattern) - 1; $i >= 0; $i--)
332332
{
333-
if ($pattern{$i} == $dot)
333+
if ($pattern[$i] == $dot)
334334
{
335335
break;
336336
}
337-
if ($pattern{$i} == $digit)
337+
if ($pattern[$i] == $digit)
338338
{
339339
$decimalPoints = $i - $decimalPos;
340340
break;

lib/plugins/sfPropelPlugin/lib/vendor/creole/drivers/pgsql/PgSQLResultSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function strToArray($str)
137137
$res[] = $this->strToArray(implode(',', $subarr[$in_subarr]));
138138
$in_subarr--;
139139
}
140-
} elseif ($tok{0} === '{') { // we're inside a new sub-array
140+
} elseif ($tok[0] === '{') { // we're inside a new sub-array
141141
if ('}' !== substr($tok, -1, 1)) {
142142
$in_subarr++;
143143
// if sub-array has more than one element

lib/plugins/sfPropelPlugin/lib/vendor/creole/util/sql/SQLStatementExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected static function substring($string, $startpos, $endpos = -1) {
143143
trigger_error("substring(), Endindex out of bounds must be $startpos<n<".($len-1), E_USER_ERROR);
144144
}
145145
if ($startpos === $endpos) {
146-
return (string) $string{$startpos};
146+
return (string) $string[$startpos];
147147
} else {
148148
$len = $endpos-$startpos;
149149
}

lib/plugins/sfPropelPlugin/lib/vendor/phing/Phing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ public static function getResourcePath($path) {
916916
// This is a bit of a hack, but works better than previous solution of assuming
917917
// data_dir is on the include_path.
918918
$data_dir = '@DATA-DIR@';
919-
if ($data_dir{0} != '@') { // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
919+
if ($data_dir[0] != '@') { // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
920920
$data_path = $data_dir . DIRECTORY_SEPARATOR . $path;
921921
if (file_exists($data_path)) {
922922
return $data_path;

lib/plugins/sfPropelPlugin/lib/vendor/phing/lib/Capsule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ function parse($template, $outputFile = null, $append = false) {
183183
* @return string "Best guess" path for this file.
184184
*/
185185
protected function resolvePath($file, $basepath) {
186-
if ( !($file{0} == DIRECTORY_SEPARATOR || $file{0} == '/')
186+
if ( !($file[0] == DIRECTORY_SEPARATOR || $file[0] == '/')
187187
// also account for C:\ style path
188-
&& !($file{1} == ':' && ($file{2} == DIRECTORY_SEPARATOR || $file{2} == '/'))) {
188+
&& !($file[1] == ':' && ($file[2] == DIRECTORY_SEPARATOR || $file[2] == '/'))) {
189189
if ($basepath != null) {
190190
$file = $basepath . DIRECTORY_SEPARATOR . $file;
191191
}

0 commit comments

Comments
 (0)