SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Auckland, New Zealand
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Should I recode?

    I'm the developer for a service in PHP. Part of the service requires registering a domain name, which is relatively simple given most domain registras have an API available. I'm building the web site using Zend Framework in PHP5. The problem is that the API library given to me is written for use with php 3 or 4, and so uses all the depreciated function calls and does annoying things like define constants more than once etc! This causes lots of notices about depreciated functions and warnings when the app runs.

    If I set e_notice and e_warning off, the API works fine. However, this seems like a bad hack to me. I've turned error reporting to strict in my bootstrap file for ZF, and I want to keep it this way. I could turn error reporting off for the API includes and calls, but this could get really messy.

    Rewritting the library seems like a big mission (it's a few thousand lines, and it's not exactly easy to follow!)

    Is there a common solution to a problem like this? This is the first time I've used an external library. I will value any advice. Thanks in advance!

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sievert View Post
    If I set e_notice and e_warning off, the API works fine. However, this seems like a bad hack to me.
    Yes, that sounds like a bad idea.

    Quote Originally Posted by sievert View Post
    Rewritting the library seems like a big mission (it's a few thousand lines, and it's not exactly easy to follow!)
    It should be rather trivial to turn on warnings/notices and then weed out the bugs, one by one. You need to understand the problems of course, but you don't necessarily need to understand all details of the library to fix most warnings.

    The question you need to answer is how long you expect to use this library. If it's a short-term, patching it up and hope for the best may be the easiest, but if you have to maintain the application for more than a couple of months, I would probably look into a rewrite. Errors are bound to arise at some point, and if you don't understand the code, you have little chance of debugging it. It sounds like a relatively small and well-defined library anyway, so it shouldn't be that big of a task to rewrite it.

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Auckland, New Zealand
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah true, I could filter out the bugs. The double defining on constants all all that would be easy.

    I have pretty much no knowledge of how to do RPC calls (which is what this library does) so I have a feeling my rewrite would be inferior to it. Perhaps it wouldn't, but I'm not expecting much for my first go.

    I'll be maintaining the project indefinitely, so it could be a few years rather than a few months

  4. #4
    SitePoint Addict chestertondevelopment's Avatar
    Join Date
    Dec 2005
    Location
    Essex, UK
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Zend Framework has a mature RPC module, you say you're using ZF so that should cover a lot of it.

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Auckland, New Zealand
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks heaps for the help! I'll have a go recoding it with the use of Zend XML RCP

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Auckland, New Zealand
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm running on ZF 1.5.2 and php 5.2.3 and have this issue:

    exception 'Zend_XmlRpc_Client_FaultException' with message 'Invalid response' in /var/www/frameworks/Zend/XmlRpc/Client.php:261

    I'm using the example code provided in the ZF manual

    <?php
    require_once 'Zend/XmlRpc/Client.php';

    $client = new Zend_XmlRpc_Client('framework.zend.com/xmlrpc'); // had to remove http part from forums because I can't post links..wtf?

    echo $client->call('test.sayHello');

    any help would be greatly appreciated!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •