Random blurps and rants about programming
RSS icon Email icon Home icon
  • Webservices make everything easy

    Posted on June 6th, 2009 klti No comments

    Scenario: PHP application has to use a couple of Webservices provided bei .NET/C#/IIS/whatever.

    Should be easy, right? Not when you have to login with a separate webservice call to use the services you really want. This little fun thing requires the client to actually process cookies. Which the PHP SOAPClient does surprisingly well, without brute force required. But the server kept loosing the session sometimes. We tried different PHP versions, different operating systems, different internet connections, hell, I even hacked together a client in Java.

    Then we finally figured it out: the server didn’t care if the Client says he only speaks HTTP 1.0, the server just asumed HTTP 1.1. Which essentially requires to make all the webservice calls over the same TCP connection. This is where it gets tricky.

    The PHP SOAPClient allows you to reimplement a method named “__doRequest”, which does the actual network operations. So we took a HTTP 1.1 compliant connector (Zend_HTTP_Client), and implemented the request handling with it. Should be fine now, right?

    Guess again, now we are actually getting to the strangest part. For some Reason, die SOAPClient crashed PHP right within __doRequest. While trying to debug it, I discoverd something REALLY strange. Tho following code, added to __doRequest, makes PHP crash less often:

    ob_start();
    print “abc”;
    ob_end_clean();

    And to make it even stranger, if you replace the “print” with an “echo”, it doesn’t help anymore. WTF?!? My guess is, that __doRequest has a memory leak under certain conditions, which lets everything else go south from there on.

  • API broken – who cares?

    Posted on February 11th, 2009 klti No comments

    Dont get me wrong, I really love the symfony PHP framework. But some things really annoy me.

    For example, in late november there has been some minor bugfixing, followed by a new version release. Which broke the API of a pretty basic class for no reason (method getI18NGlobalDirs got renamed to getDecoratorDirsGlobalDirs). :evil:

    But accidents can happen, I hear you say. Yes they can. The mistake got fixed 9 days later, a new Version got rolled out.  Well, fixed is too much for this, it got a lillte bit less broken, (method got renamend to getI18NDirsGlobalDirs).

    In late december, this has been discovered and finally fixed. No new version has been rolled out yet.

    Long story short, the API is broken since november and the broken version is still the latest. Which sucks when your using the stable version in some big projects. :evil:

    UPDATE:
    Finally, after several months, Version 1.1.7 has been released.