{"id":95,"date":"2006-10-05T00:42:15","date_gmt":"2006-10-05T07:42:15","guid":{"rendered":"https:\/\/dubinko.info\/blog\/2006\/10\/05\/how-php-can-be-annoying\/"},"modified":"2006-10-05T00:42:15","modified_gmt":"2006-10-05T07:42:15","slug":"how-php-can-be-annoying","status":"publish","type":"post","link":"https:\/\/dubinko.info\/blog\/2006\/10\/how-php-can-be-annoying\/","title":{"rendered":"How PHP can be annoying"},"content":{"rendered":"<p>On a PHP 4 project, I need to use XSLT, but the interfaces seem far more complicated than they should be. Check out this declaration for the function to run an XSLT:<\/p>\n<blockquote><p>mixed <strong class=\"methodname\">xslt_process<\/strong> ( resource xh, string xmlcontainer, string xslcontainer [, string resultcontainer [, array arguments [, array parameters]]] )<\/p><\/blockquote>\n<p>Wow, it returns a &#8220;mixed&#8221;, that&#8217;s some helpful documentation worth looking up. And all I have to do is pass in an &#8220;xmlcontainer&#8221; and &#8220;xslcontainer&#8221;. In practice, you end up with hard-to-read code like this:<\/p>\n<blockquote><p><code>$arguments = array('\/_xml' => $xml, '\/_xsl' => $xsl);<br \/>\n$xslproc = $xslt_create();<br \/>\n$result = xslt_process($xslproc, 'arg:\/_xml', 'arg:\/_xsl', NULL, $arguments);<\/code><\/p><\/blockquote>\n<p>Too bad I have already-parsed objects. And then there&#8217;s this:<\/p>\n<blockquote><p><strong>Warning<\/strong>: As of PHP 4.0.6, this function no longer takes XML strings in        <var class=\"parameter\">xmlcontainer<\/var> or        <var class=\"parameter\">xslcontainer<\/var>. Passing a string containing XML        to either of these parameters will result in a segmentation fault in        Sablotron versions up to and including version 0.95.<\/p><\/blockquote>\n<p>Whatever. In fairness, this falls mainly to the XSLT engine and not the language and the PHP 5 interfaces are much different and much improved. But still.. -m<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On a PHP 4 project, I need to use XSLT, but the interfaces seem far more complicated than they should be. Check out this declaration for the function to run an XSLT: mixed xslt_process ( resource xh, string xmlcontainer, string xslcontainer [, string resultcontainer [, array arguments [, array parameters]]] ) Wow, it returns a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[27,1],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-languages","category-stuff"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8eo8l-1x","_links":{"self":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":0,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"wp:attachment":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}