PHP Note: Uninitialized line offset: 0

I get this error in my OpenCart log. Says the error is on line 1, which:

<?php if(isset($social_discount['name']) && $social_discount['name']!="") { ?> 

I would really appreciate help in fixing this.

+4
source share
2 answers

To prevent this error, you should change your code as follows:

 <?php if(is_array($social_discount) && isset($social_discount['name']) && $social_discount['name']!="") { ?> 
+6
source

$socialdiscount is a string, not an array, so $social_discount['name'] considered as $social_discount[0] => the first character of the string. 0 not set. $socialdiscount is an empty string.

+2
source

Source: https://habr.com/ru/post/1468774/


All Articles