迁移到 PHP7 后出错
Errors after migration to PHP7
从 PHP5
迁移到 PHP7 后,我看到以下错误
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
下面是代码行
` $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);
}
最后一行是第 25 行
解决此问题的任何建议
$config->application_data->get->$_GET['section']->file
应该是
$config->application_data->get->{$_GET['section']}->file
参见:http://php.net/manual/en/migration70.incompatible.php
第 "Changes to variable handling"
节
从 PHP5
迁移到 PHP7 后,我看到以下错误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
下面是代码行
` $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);
}
最后一行是第 25 行
解决此问题的任何建议
$config->application_data->get->$_GET['section']->file
应该是
$config->application_data->get->{$_GET['section']}->file
参见:http://php.net/manual/en/migration70.incompatible.php 第 "Changes to variable handling"
节