Error detected. PDF file generation aborted: count(): Parameter must be an array or an object that implements Countable