Exception: substr(): Argument #1 ($string) must be of type string, int given