Htmlspecialchars() expects parameter 1 to be string array given laravel validation

The below view throws the following error: htmlspecialchars[] expects parameter 1 to be string, array given. Weirdly enough this code worked fine for a while before this error popped up.

[The error only comes when the following form is posted. There are no errors while the view is being loaded]

@extends[$template]

@section['content']

Report Incident

{{ csrf_field[] }}
Title
{{ $errors->first['title'] }}
Date of incident
{{ $errors->first['date'] }}
Incident Type @foreach[$types as $type => $icon] @if[$type == old['type']] {{ $type }} @else {{ $type }} @endif @endforeach
{{ $errors->first['type'] }}
Description {{ old['description'] }}
{{ $errors->first['description'] }}
Upload images [if any]
{{ $errors->first['images'] }}
Select Province @foreach[$provinces as $province] @if[$province == old['$province']] {{ $province }} @else {{ $province }} @endif @endforeach
{{ $errors->first['province'] }}
Please type in a location
{{ $errors->first['pac-input'] }}
Please select an approximate location from the map
Latitude
Longitude


var map; function initAutocomplete[]{ console.log[document.getElementById['map']]; map = new google.maps.Map[document.getElementById['map'], { center: {lat: 6.870066, lng: 79.879710}, zoom: 15 }]; var marker = new google.maps.Marker[{ position: { lat: 16.870066, lng: 80.879710 }, map: map, draggable: true }]; // document.getElementById['lat'].value = marker.getPosition[].lat[]; // document.getElementById['lng'].value = marker.getPosition[].lng[]; var input = document.getElementById['pac-input']; var searchBox = new google.maps.places.SearchBox[input]; google.maps.event.addListener[searchBox, 'places_changed',function[]{ var places = searchBox.getPlaces[]; var bounds = new google.maps.LatLngBounds[]; var i, place; for [i=0; place=places[i]; i++] { bounds.extend[place.geometry.location]; marker.setPosition[place.geometry.location]; } map.fitBounds[bounds]; map.setZoom[15]; }]; google.maps.event.addListener[marker, 'position_changed', function[]{ var lat = marker.getPosition[].lat[]; var lng = marker.getPosition[].lng[]; document.getElementById['lat'].value = lat; document.getElementById['lng'].value = lng; }]; } @endsection

I think it has something to do with my declaration of my file uploads input:

Upload images [if any]
{{ $errors->first['images'] }}

The name I have given the following input is images[] since I want multiple images to be uploaded. When I change the name from images[] to images, the error seems to go away but no images are uploaded/saved [if needed the code to handle the backend image uploading can be posted as well].

Chủ Đề