You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since strict typing was added, I get this error in my application:
TypeError: Argument 1 passed to Metroplex\Edifact\Serializer::escape() must be of the type string, null given, called in /var/app/gas/vendor/metroplex-systems/edifact/src/Serializer.php on line 61
/var/app/gas/vendor/metroplex-systems/edifact/src/Serializer.php:79
/var/app/gas/vendor/metroplex-systems/edifact/src/Serializer.php:61
/var/app/gas/vendor/metroplex-systems/edifact/src/Message.php:151
...
The problem is that I have added non-strings (null, integers) as values to segments as I build them up. While I could change the code on my end to coerce into string, I don't think it would be unreasonable for the library to do this transparently, as it used to. I suggest changing Serializer::escape as follows:
Hi @troelskn sorry for the delay here! Transparently converting here seems reasonable, however I'd like to bundle this with a clear error for when the value cannot be escaped, if you're like to throw up a PR for that then I would be happy to take a look, if not I'll tackle this myself when I get a moment
Hi @troelskn just checking back in if this is still an issue?
This library has never used strict types, so presumably the integers and other numbers are not a problem, the only issue you're seeing is with null? If so I'd be happy to change this method to accept null and silently convert to "" does that work for you?
Since strict typing was added, I get this error in my application:
The problem is that I have added non-strings (null, integers) as values to segments as I build them up. While I could change the code on my end to coerce into string, I don't think it would be unreasonable for the library to do this transparently, as it used to. I suggest changing
Serializer::escape
as follows:Would you like me to open a PR for this?
The text was updated successfully, but these errors were encountered: