Re: Re: RFC::Error Handling Guidelines for PHP5 packages
| From: | Joshua Eichorn | Date: | Tue, 24 Aug 2004 23:05:29 +0000 |
| Subject: | Re: Re: RFC::Error Handling Guidelines for PHP5 packages | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32925@lists.php.net to get a copy of this message | ||
Hans Lellelid wrote:
Klaus Guenther wrote:I just want to make the point that for a long time your going to have php5 code living with old php4 code. In your code, in PEAR in everywhere. Now i think you'll be running php5, just not E_STRICT, which means. php5 code doesn't have to be backwards compatiable, but you need to think on howto to use your php4 code in php5. That might be a recommonadation of setting up a global error/exception handler, and if any php4 or 5 code has an error you pretty much have to die (this is what i ended up doing). And then writing up howto convert pear_error* to pear_exception's (in user code, and by updated the classes). I thought that was what Davey was asking for (maybe im wrong). Its pretty much saying, i'm going to run php4 code in php5 apps for the next couple months/years. So what do I need to make it work. His suggestion was make PEAR_error automatically work with PEAR_ErrorStack, make it easy to use the ErrorStack in php5, while still using exceptions for php5 only code. Maybe im misunderstanding, but i can garentee that anyone who thinks converting things like DB, MDB, or HTML_QuickForm (not to mention something huge like phpDocumentor) to php5 is easy is just wrong. So any RFC just needs to define some best practices and then make sure the code to make those happens exists. Let me repeat. in PHP5 you have to use RFC style error handling or your hosed, and you can't use any of your old php4 code is not a real soltuion. It will just make widespread use of PHP5 take longer, and give people more reasons to grumble about PEAR. (Also as a side note, saying you shouldn't use exceptions in new PHP5 code is just as bad) -joshHans L wrote:Yes, I think the central difference then between people like myself is that we think upgrading to PHP5-only packages justifies the major work. PHP5 introduces major new features; can't expect to be able to use those & keep BC. For your PHP4 application, you can always keep using PHP4 packages ... But with Davey's proposal you cripple PHP5 applications by making them PHP4-compliant. I don't see that as a winning solution at all. Why would anyone even contribute PHP5 packages, in that case? There has to be something different and better about PHP5 to make it worth upgrading. There is: exceptions. -Hans I agree with you that it makes sense for php5. I'm using it as a reason to improve a lot of my own horribly hacked up code and to use exceptions and private class variables, some different design patterns etc.Joshua Eichorn wrote:Yes, but... once PEAR packages have been migrated, it will require a redesign of _all_ applications that depend on it. If Greg's solution would be used, it would require minimal changes to applications depending on the package. If the package would be fully migrated to exceptions, it would be a _major_ headache to update a complex application.Yes, I wasn't talking about migrating apps; I was talking about migrating PHP4-only PEAR packages for use in my PHP5-only applications. Migrating complex n-tier applications certainly requires application redesign. Migrating single-layer PEAR packages generally does not.For serious PHP5 web applications, I just don't see legacy integration as a huge concern, given that migration is generally fairly quick & easy, and certainly I wouldn't want to have to have both PEAR_Exception and PEAR_Error being used in my app.You must not be in the process of migrating a serious app then. Changing use of pear_error or whatever your php4 solution was to exceptions takes lots of redesign, coding and testing.