apachephp-7.2rhel6

Errors after migration to PHP7


I am seeing the following error after migrating to PHP7 from PHP5

PHP Notice:  Array to string conversion in /data/get.php on line 25
PHP Notice:  Undefined property: stdClass::$Array in /data/get.php on line 25
PHP Notice:  Trying to get property 'file' of non-object in /data/get.php on line 25
PHP Warning:  include(): Filename cannot be empty in /data/get.php on line 25
PHP Warning:  include(): Failed opening '' for inclusion (  include_path='.:/apps/php-7.2.9/lib/php') in /data/get.php on line 25

Following the are lines of code

 ` $arr_no_security = array("casestudy","homesharepins", "videotour", "questionengine","casestudysplash");
   $security_check = (!in_array($_GET['section'],$arr_no_security));

  require_once('includes/app.php');

 if(!Security::is_error())
 {
    if (isset($_GET['section']))
    {
            include('sections/section.header.inc.php');
            $bln_file_included = false;
            foreach ($config->application_data->get as $section => $value)
            {
                    if (strtolower($_GET['section']) == strtolower($section)) {
                            $bln_file_included = true;
                                     include($config->application_data->get->$_GET['section']->file);
                    }

The last line is line no 25

Any suggestions to resolve this


Solution

  • $config->application_data->get->$_GET['section']->file

    should be

    $config->application_data->get->{$_GET['section']}->file

    See: http://php.net/manual/en/migration70.incompatible.php Section "Changes to variable handling"