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
$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"
Related
I want to make my checkbox is enabled and disable when user login from my data
My syntaks in asp.net:
if (Session["Berhasil"] != null)
{
Label1.Visible = true;
Label1.Text = "Berhasil..";
if(Label1 = "select * from cs100020 where countno=2 and status=3");
{
cbxinven.Enabled=true
cbxfinadmin.Enabled=true
cbxkaskecil.Enabled=true
cbxemail.Enabled=false
cbxsap.Enabled=false
cbxpc.Enabled=false
cbxuserad.Enabled=false
}
else (Label1="select * from cs100020 where countno=3 and status=3);
{
cbxinven.Enabled=false
cbxfinadmin.Enabled=false
cbxkaskecil.Enabled=false
cbxemail.Enabled=true
cbxsap.Enabled=true
cbxpc.Enabled=true
cbxuserad.Enabled=true
}
}
and i got error :
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1010: Newline in constant
Source Error:
Line 137: cbxuserad.Enabled=false
Line 138: }
Line 139: else (Label1="select * from cs100020 where countno=3 and status=3);
Line 140: {
Line 141: cbxinven.Enabled=false
Source File: d:\Sharing\Budiman\IAPHRM BACKUP 08022019\IapHRM_180119_Backup\ViewCS.aspx.cs Line: 139
Show Detailed Compiler Output:
Show Complete Compilation Source:
The closing double quote on the SQL statement for the ELSE branch (i.e. else (Label1 = .... line) is missing.
I'm using the following script in PHP 5.5.9 to unset all variables, which works great
$vars = array_keys(get_defined_vars());
for ($i = 0; $i < sizeOf($vars); $i++) {
unset($$vars[$i]); //this is line 72
}
unset($vars,$i);
However, in PHP 7, they give the following messages:
PHP Notice: Array to string conversion in /root/script.php on line 72
PHP Notice: Undefined variable: Array in /root/script.php on line 72
My question is how to make the script work in PHP 7?
Thanks for any suggestion!
You can avoid those errors by using foreach instead of for.
$vars = array_keys(get_defined_vars());
foreach ($vars as $var) {
unset($$var);
}
unset($vars, $var);
The order of evaluation of $$vars[$i] is different in PHP 7. It's now strictly left to right.
Previously it would have first evaluated $vars[$i] and then formed a new variable from the result of that with $.
Now it first evaluates $$vars and then tries to find [$i] in the result of that.
I got this notice in Prestashop 1.6.1.0 Stats>Catalog Evaluation.
Notice: Undefined index: desclength_zh in /var/www/1cdeli.com.cn/public_html/modules/statscheckup/statscheckup.php on line 259
Notice: Undefined index: desclength_en in /var/www/1cdeli.com.cn/public_html/modules/statscheckup/statscheckup.php on line 259
I had same issue before updating from 1.6.0.14.
Control you have the same of latest version module, like this :
foreach ($descriptions as $description)
{
if (isset($description['iso_code']) && isset($description['description']))
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
if (isset($description['iso_code']))
{
$scores['description_'.$description['iso_code']] = ($row['desclength_'.$description['iso_code']] < Configuration::get('CHECKUP_DESCRIPTIONS_LT') ? 0 : ($row['desclength_'.$description['iso_code']] > Configuration::get('CHECKUP_DESCRIPTIONS_GT') ? 2 : 1));
$totals['description_'.$description['iso_code']] += $scores['description_'.$description['iso_code']];
}
}
Module Git: https://github.com/PrestaShop/statscheckup/blob/master/statscheckup.php
I am using ancart template for opencart. These errors are shown
Notice: Undefined variable: small_html in /home/rythm321/public_html/catalog/view/theme/ancart/template/common/header.tpl on line 113
Notice: Undefined variable: org_html in /home/rythm321/public_html/catalog/view/theme/ancart/template/common/header.tpl on line 137
Here is the header file https://www.dropbox.com/s/7heyayzwoewjmqt/header.tpl
Change:
if ($categories) {
$org_html = "";
$small_html = "";
To:
$org_html = "";
$small_html = "";
if ($categories) {
As the variables are defined within the if condition, they'll not get defined if the if condition returns false.
Have a nice day !!
you should select "Show in the top menu" from the category edit menu each other.
I am using the simplest controller and model as shown here:
http://book.cakephp.org/view/1341/Basic-Usage
But when i go to www.mysite.com/categories
the code that causes it is:
<?php
class CategoriesController extends AppController {
var $name = 'Categories';
function index() {
$this->data = $this->Category->generatetreelist(null, null, null, ' ');
debug ($this->data); die;
}
}
?>
i get the following error:
Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'recover' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
Code | Context
$out = null;
if ($error) {
trigger_error('<span style="color:Red;text-align:left"><b>' . __('SQL Error:', true) . "</b> {$this->error}</span>", E_USER_WARNING);
$sql = "recover"
$error = "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'recover' at line 1"
$out = null
DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, line 684
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 266
DboSource::fetchAll() - CORE/cake/libs/model/datasources/dbo_source.php, line 410
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php, line 364
Model::call__() - CORE/cake/libs/model/model.php, line 502
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 50
AppModel::recover() - [internal], line ??
CategoriesController::index() - APP/controllers/categories_controller.php, line 7
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83
Query: recover
app/controllers/categories_controller.php (line 8)
I am totally confused, since I just copy-pasted from the original cakephp cookbook tutorial.
I have:
controllers/categories_controller.php
models/category_model.php
and the code is copy paste from the tutorial.
Any help?
Problem solved. Misnaming the model file.
It Was: category_model.php
Should have been: category.php =(
Have you created the Category Model?
I am not sure but I belive you should tell the controller which model u intend to use by specifying:
var $name = 'Categories';
var $uses = array("Category");
function index() {
$this->data = $this->Category->generatetreelist(null, null, null, ' ');
debug ($this->data); die;
}