fixing PHP Fatal error:  Method InputElement::__toString() must not throw an exception