[PHP] More PEAR libraries that suck? Say it ain’t so, XML_RPC2!
If you've paid attention, you'll know that I'm not particularly fond of most PEAR libraries. I appreciate the developers who spend their time maintaining them, and they generally save me some amount of potential time. But I don't think I've seen a single one with code that doesn't make me want to jump off the GGB.
If you recently upgraded to PHP5.3, and you just so happen to be using XML_RPC2, you may notice that... everything works fine. But conversely, you may notice that nothing works at all and your program dies with no error messages of any sort being logged anywhere, which is less awesome. If you were smart enough to actually track down the problem, and then conversely stupid enough to actually open up the XML_RPC2 code, you'd probably find your way to XML_RPC2_Backend.
XML_RPC2_Backend is what is called when you use XML_RPC2_Client::create() to get your client object. It is a supposedly pluggable architecture so you could create your own backends to RPC2 or something, although it then has a hard-coded list of types it will actually allow, so it's not really pluggable at all, but uh.. yeah. Also, super LOLs to this snippet of useless clock cycles (what's the point of ucfirst???):
$backend = ucfirst(strtolower($backend));
if (
$backend != 'Php' &&
$backend != 'Xmlrpcext'
)
Anyway, point is, it first checks for the existence of the xml_rpc extension in PHP, and does so by force-loading the extension if it can't find the functions from the library. Seriously?? Whatever. I guess it ultimately wouldn't be a huge problem, except for one small caveat from the manual for the dl() function:
This function has been removed from some SAPI's in PHP 5.3.
Apparently due to 'stability issues', PHP no longer includes the dl() function in most of their distributions. (Why they didn't remove it completely is a mystery, honestly.) They suggest people just update their php.ini's instead or something.
THE POINT BEING: If your xml_rpc extension install either: 1) Doesn't exist because you don't want to include it, or 2) Isn't loaded by default, and you're running one of these SAPI's, XML_RPC2 will crash and burn gloriously by forging ahead and calling dl() just in case. I suggest just going directly into the XML_RPC2_Backend::getBackend() method and completely commenting out where it tries to load XMLRPCext. Seriously worthless.