pigochu / yii2-jquery-locationpicker

jquery location picker widget for yii2
20 stars 7 forks source link

CoordinatesPicker Undefined offset: 0 #4

Closed jusernt closed 7 years ago

jusernt commented 8 years ago

When I use the "CoordinatesPicker" widget launches the error " Notice PHP - Yii \ base \ ErrorException Undefined offset: 0 ... "

File: CoordinatesPicker.php Line: 105 $this->clientOptions['location'] = [ 'latitude' => floatval($matches[0]['latitude']), 'longitude' => floatval($matches[0]['longitude']), ];

My problem is my database field is empty or NULL.

In the same file add "|| empty ($ coordinates)": Line: 85 if($coordinates === null || empty($coordinates)) { return; }

If not the best solution, but it worked, thanks for the Plugin

pigochu commented 8 years ago

Thank you report the bug

I added the code you provided "if($coordinates === null || empty($coordinates))" , and upgrade to 0.1.3 , please update via composer and try again.