Skip to content

Commit

Permalink
PHP 7.4 fix, don't use curly braces for array/string offset
Browse files Browse the repository at this point in the history
The array and string offset access syntax using curly braces is deprecated.
Use $str[$idx] instead of $str{$idx}.
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
  • Loading branch information
stronk7 committed Oct 30, 2019
1 parent f37231e commit f6f6d0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion h5p-development.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function findLibraries($path) {
$contents = scandir($path);

for ($i = 0, $s = count($contents); $i < $s; $i++) {
if ($contents[$i]{0} === '.') {
if ($contents[$i][0] === '.') {
continue; // Skip hidden stuff.
}

Expand Down
2 changes: 1 addition & 1 deletion h5p.classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2744,7 +2744,7 @@ public static function snakeToCamel($arr, $obj = false) {
foreach ($arr as $key => $val) {
$next = -1;
while (($next = strpos($key, '_', $next + 1)) !== FALSE) {
$key = substr_replace($key, strtoupper($key{$next + 1}), $next, 2);
$key = substr_replace($key, strtoupper($key[$next + 1]), $next, 2);
}

$newArr[$key] = $val;
Expand Down

1 comment on commit f6f6d0f

@marclaporte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: #84

Please sign in to comment.