Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-20203 FreePBX 15 compatibility with PHP 7.3
  3. FREEPBX-20267

PHP 7.0 variable handling change breaks start/stop module hooks

    XMLWordPrintable

    Details

    • Type: Sub-Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 14
    • Fix Version/s: 15.0.16.9
    • Component/s: FreePBX Framework
    • Labels:
      None
    • ToDo:

      Description

      fwconsole start or stop results in this error: 

      Unable to locate the FreePBX BMO Class 'Array'A required module might be disabled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole ma install array 2) fwconsole ma enable array

      The root of this error is the calls in framework.../admin/libraries/Console/Start.class.php and Stop.class.php that look like this:

       

      
      $bmo->$data['module']->$data['method']($output); 
      

      (one instance in each of Start.class.php and Stop.class.php)

      PHP documentation describes a change in behavior from 5.x to 7.x where operator order has changed: https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect

      The solution is to wrap curly brackets around the $data['module'] and $data['method']:

      
      $bmo->{$data['module']}->{$data['method']}($output);
      

      This change is backward compatible from 7.3 through 5.x.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                billsimon billsimon
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: