Curly brace issue. planning to upgrade to freepbx 16 in phases

Hi I am planning upgrades to a number of freepbx servers. Note, I’m using RHEL 7 not sng linux and i’m in a “corporate enviroment” which means i have lots of rules from different IT departments. So sometimes which is very logical is not available to me.

so with the latest modules (Freebox Recording module 15.0.3.19) I’m getting the message below after upgrading php 5.6 to php 7.4.

I appears there is a issue in that code with braces. Is there an easy patch? (even if it sets off the tamper module to let me sperae the changes into smaller bits or do I have to do a 16 install at the same time?

/var/www/html/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php
*/

if(is_array($text))
{
  foreach($text as $k => $v)
  {
    $text[$k] = self::toUTF8($v);
  }
  return $text;
}

if(!is_string($text)) {
  return $text;
}

$max = self::strlen($text);

$buf = "";
for($i = 0; $i < $max; $i++){
    $c1 = $text{$i};
    if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
      $c2 = $i+1 >= $max? "\x00" : $text{$i+1};
      $c3 = $i+2 >= $max? "\x00" : $text{$i+2};
      $c4 = $i+3 >= $max? "\x00" : $text{$i+3};
        if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
            if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
                $buf .= $c1 . $c2;
                $i++;
            } else { //not valid UTF8.  Convert it.
                $cc1 = (chr(ord($c1) / 64) | "\xc0");
                $cc2 = ($c1 & "\x3f") | "\x80";
                $buf .= $cc1 . $cc2;
            }
        } elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8
            if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already
                $buf .= $c1 . $c2 . $c3;
                $i = $i + 2;
            } else { //not valid UTF8.  Convert it.
                $cc1 = (chr(ord($c1) / 64) | "\xc0");
                $cc2 = ($c1 & "\x3f") | "\x80";

Arguments
“Array and string offset access syntax with curly braces is deprecated”

FreePBX 15 is not compatible with php 7.4. You have to upgrade php and FreePBX at the same time. Use the versionupgrade module.

Hacking at the modules could leave your pbx in a fragile state but if you want to go that route you can change the {} to [] on those array indices.

To me it doesn’t make sense to use RHEL “because support/policy” and then do things outside of the prescribed way. The upgrade to 16 is pretty easy.

That is another issue. The versionupgrade module is commercial so I can’t run it either.

The versionupgrade is in the commercial repo but requires no licensing nor sysadmin module to run. Wiki here: Non Distro - Upgrade to FreePBX 16 - FreePBX OpenSource Project - Documentation

Thanks for the link I’m running a test through.

A deprecation does not stop the system from working, and can be ignored. Many FreePBX modules are using fixed (and extremely outdated) versions of libraries, so they’re quite common. But as Bill says an upgrade to 16 is the best bet.