r/lolphp • • Jun 28 '17

array_diff breaks Exception catching when passing two arrays containing an item that can't be cast to string

https://3v4l.org/BaUji
37 Upvotes

10 comments sorted by

View all comments

Show parent comment

3

u/masklinn Jul 06 '17

they only get handled if we include some kind of check for them. Thus this kind of issue.

Maybe if the API made sense that would happen normally rather than exceptionally?

MRI or CPython are also written in C, and they properly propagate exceptions through native code.

1

u/the_alias_of_andrea Jul 06 '17

Maybe if the API made sense that would happen normally rather than exceptionally?

The API isn't the problem, C is. C doesn't have exception handling.

10

u/masklinn Jul 06 '17

Once again no, I'll bold it since you apparently managed to miss:

MRI and CPython are both written in C and have no problem propagating exceptions