Today, I updated
ZBatesonMailMimeParser the PHP e-mail parser library from 1.x to 2.x.
Soon enough, my PHP error log started filling up with errors.
Noting where it happened, I found out that it had to do with their
::parse(...) function: https://mail-mime-parser.org/upgrade-2.0
An additional parameter needs to be passed to Message::from() and MailMimeParser::parse() specifying whether the passed resource should be ‘attached’ and closed when the returned IMessage object is destroyed, or kept open and closed manually after the message is parsed and the returned IMessage destroyed.
That is, instead of picking one of those new “modes” by default, the author(s) simply chose to break all existing code.
Frankly, even after re-reading that page multiple times, I have no clue what the new parameter actually does. I have set it to
true just to make the errors stop happening, but I’m worried that this is somehow not the right choice.
My point, and question, is: Why do library developers knowingly break existing code like this? Why not at least have it default to either
false, whichever is the most reasonable?
Before you tell me that I should have read the upgrade instructions before updating, I sometimes do, but when your life consists of nothing but dealing with constant updates of all kinds of software, you eventually get numb to all the changes and stop spending the time and effort to do so. Is it really reasonable that updating a library (in particular) should break existing code?
And this is not some sort of edge-case of the library, either. It’s literally the #1 reason for it to exist in the first place, sure to be used by every single user: parsing an e-mail blob!