cancel
Showing results for 
Search instead for 
Did you mean: 

magento 2 - Error filtering template: Notice: Trying to access array offset on value of type null

magento 2 - Error filtering template: Notice: Trying to access array offset on value of type null

I am getting

Error filtering template: Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\m3\app\code\Zero\Storelocator\view\frontend\templates\google_reviews.phtml on line 4

 

line no. 4: $allData = array_slice($allcollection['reviews'], 0, 5, true);

 

Full code: https://paste.ofcode.org/334bFgXch3bnAWJGaSr5wwh

 

Function, line no. 3 : getCustomerReview()

 

Function Code: FUll code : https://paste.ofcode.org/F7Jz4EUa5X9shkZF9MuRu6

 

function start from line no. 23

 

Why i am getting this error

Error filtering template: Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\m3\app\code\Zero\Storelocator\view\frontend\templates\google_reviews.phtml on line 4